{"id":7001,"date":"2014-12-12T18:00:03","date_gmt":"2014-12-12T16:00:03","guid":{"rendered":"http:\/\/blog.zhaw.ch\/icclab\/?p=7001"},"modified":"2014-12-16T10:29:37","modified_gmt":"2014-12-16T08:29:37","slug":"managing-ceilometer-data-in-openstack","status":"publish","type":"post","link":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/","title":{"rendered":"Managing ceilometer data in openstack"},"content":{"rendered":"<p>Ceilometer can collect a large amount of data, particularly in a system with large amount of servers and high activity: in such a scenario, the numbers of meters and samples can be large which \u00a0affects ceilometer performance and gives rise to quite large databases. In our particular case we are studying energy consumption in servers and how resource utilization (mainly cpu) may relates to overall energy consumption. The energy data is collected through Kwapi and stored in ceilometer every 10 seconds (yes, this is probably too fine-grained!). We had problems that the database accumulated too quickly, filling up the root disk partition on the controller and causing significant problems for the system. In this blog post, we describe the approach we now use for managing ceilometer data which ensures that the resources consumed by ceilometer remain under control.<!--more--><\/p>\n<p>In some cases, if you have done a standalone installation and haven\u2019t considered ceilometer at the installation stage, the database may be \u00a0configured in the root partition: this is not ideal for quite obvious reasons &#8211; filling up the root file system can render the system inoperable. \u00a0For this reason, we advise that the ceilometer db backend be put on a partition different from the root partition. For mongodb, this is as simple as changing the dbpath parameter in the \/etc\/mongodb.conf config file. Then a simple restart of mongo is required.<\/p>\n<h2><b>Backing up Mongodb Data<\/b><\/h2>\n<p>Now with the database up and running in a different partition we can trigger a cron job which backs up the data from ceilometer regularly. We wrote a simple python script to dump selected contents of the mongodb monthly and compress it &#8211; the data can then be archived somewhere else. In our case, we found that the dumped data compresses down to approximately 10% of the size of the dump.<\/p>\n<p>The <a href=\"https:\/\/github.com\/icclab\/arcus-energy-monitoring-tool\/blob\/master\/Tools\/mongo_backup.py\">simple python script<\/a> we wrote uses mongodump inside the <a href=\"https:\/\/docs.python.org\/2\/library\/subprocess.html\">python subprocess library<\/a> (it only works with <a href=\"http:\/\/www.mongodb.org\/\">Mongodb<\/a> databases right now). Subprocess was used because python mongodb libraries such as pymongo are not really intended for large import or exports &#8211; they are more intended for standard database interactions. \u00a0We did, however, need to use pymongo to understand which collections exist in the db and this information was then used as an input to mongodump. In the script, the collections are then backed up in a temporary directory using zip.<\/p>\n<p><i>The script requires <\/i><a href=\"http:\/\/api.mongodb.org\/python\/current\/\"><i>pymongo<\/i><\/a><i> and zip support as well as ZIP64_SUPPORT for files larger than 64GB. The tmp and zip directories can be changed in the script.<\/i><\/p>\n<h2><b>Setting up ceilometer-expirer<\/b><\/h2>\n<p>Setting up an archiving system as above, is not sufficient to ensure that the db size is controlled &#8211; it is also necessary to remove redundant data from the db. Fortunately, with mongo this is very straightforward: mongo has support for expiry of data and performs internal cleanup operations to remove expired data.<\/p>\n<p>Ceilometer has support for data expiry and the time_to_live parameter in ceilometer.conf controls how long the data will remain in the database. In general, the time_to_live for samples defaults \u00a0to -1 in ceilometer, which means that the samples have no expiry date. The ceilometer-expirer component of ceilometer manages data expiry and<a href=\"http:\/\/docs.openstack.org\/admin-guide-cloud\/content\/section_telemetry-storing-data.html\"> its behaviour is dependent on which db backend is being used<\/a>. In the case of mongo, if the time_to_live parameter is not -1, a new index is added to collections which has a timestamp field and mongo deletes the samples older than the configured ttl value. In the case of other dbs, such as mysql, ceilometer-expirer proactively removes entries from the database which have expired.<\/p>\n<p>It is worth noting that as well as the expired meter\/sample data, Ceilometer-expirer removes other entries in the db which which are not linked to any other entries, e.g. information relating to an instance which was terminated some time ago.<\/p>\n<p>In case you want to add expiry information to a particular collection directly within the mongo backend it is possible using the following command in the mongodb client:<\/p>\n<p style=\"text-align: center\">db.meter.ensureIndex( { &#8220;timestamp&#8221;: 1 }, { expireAfterSeconds: 2764800 } )<\/p>\n<p>However, using this approach is not advised &#8211; it is much more sensible to configure ceilometer appropriately to ensure data expires correctly.<\/p>\n<p>The above basic approach to ceilometer data management should ensure that ceilometer data does not grow uncontrollably and makes it highly unlikely that ceilometer data would render the system inoperable.<\/p>\n<p>If you&#8217;re interested in this topic, you may be interested in some of our other blog posts:<\/p>\n<ul>\n<li><a href=\"http:\/\/blog.zhaw.ch\/icclab\/collecting-energy-consumption-data-using-kwapi-in-openstack\/\">Collecting energy consumption data using Kwapi in Openstack<\/a><\/li>\n<li><a href=\"http:\/\/blog.zhaw.ch\/icclab\/web-application-to-monitor-and-understand-energy\/\">A Web Application to Monitor and Understand Energy Consumption in an Openstack Cloud<\/a><\/li>\n<li><a href=\"http:\/\/blog.zhaw.ch\/icclab\/understanding-the-relationship-between-ceilometer-processor-utilisation-and-system-energy-consumption-for-a-basic-scenario-in-openstack\/\">Understanding the relationship between ceilometer processor utilisation and system energy consumption for a basic scenario in Openstack<\/a><\/li>\n<li><a href=\"http:\/\/blog.zhaw.ch\/icclab\/migration-of-ceilometer-energy-consumption-data-from-havanamysql-to-icehousemongodb\/\">Migration of Ceilometer Energy Consumption Data from Havana\/MySQL to Icehouse\/MongoDB<\/a><\/li>\n<\/ul>\n<div class=\"pt-sm\">Schlagw\u00f6rter: <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/ceilometer\/\">Ceilometer<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/data\/\">data<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/database\/\">database<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/managing\/\">managing<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/mongo\/\">mongo<\/a>, <a href=\"https:\/\/blog.zhaw.ch\/icclab\/tag\/openstack\/\">openstack<\/a><br><\/div>","protected":false},"excerpt":{"rendered":"<p>Ceilometer can collect a large amount of data, particularly in a system with large amount of servers and high activity: in such a scenario, the numbers of meters and samples can be large which \u00a0affects ceilometer performance and gives rise to quite large databases. In our particular case we are studying energy consumption in servers [&hellip;]<\/p>\n","protected":false},"author":101,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[5],"tags":[65,99,525,526,432,240],"features":[],"class_list":["post-7001","post","type-post","status-publish","format-standard","hentry","category-articles","tag-ceilometer","tag-data","tag-database","tag-managing","tag-mongo","tag-openstack"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.2) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Managing ceilometer data in openstack - Service Engineering (ICCLab &amp; SPLab)<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Managing ceilometer data in openstack\" \/>\n<meta property=\"og:description\" content=\"Ceilometer can collect a large amount of data, particularly in a system with large amount of servers and high activity: in such a scenario, the numbers of meters and samples can be large which \u00a0affects ceilometer performance and gives rise to quite large databases. In our particular case we are studying energy consumption in servers [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\" \/>\n<meta property=\"og:site_name\" content=\"Service Engineering (ICCLab &amp; SPLab)\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-12T16:00:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-12-16T08:29:37+00:00\" \/>\n<meta name=\"author\" content=\"Bruno Grazioli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bruno Grazioli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\"},\"author\":{\"name\":\"Bruno Grazioli\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\"},\"headline\":\"Managing ceilometer data in openstack\",\"datePublished\":\"2014-12-12T16:00:03+00:00\",\"dateModified\":\"2014-12-16T08:29:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\"},\"wordCount\":802,\"commentCount\":1,\"keywords\":[\"Ceilometer\",\"data\",\"database\",\"managing\",\"mongo\",\"openstack\"],\"articleSection\":[\"Articles\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\",\"name\":\"Managing ceilometer data in openstack - Service Engineering (ICCLab &amp; SPLab)\",\"isPartOf\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\"},\"datePublished\":\"2014-12-12T16:00:03+00:00\",\"dateModified\":\"2014-12-16T08:29:37+00:00\",\"author\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\"},\"breadcrumb\":{\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\/\/blog.zhaw.ch\/icclab\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Managing ceilometer data in openstack\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#website\",\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/\",\"name\":\"Service Engineering (ICCLab &amp; SPLab)\",\"description\":\"A Blog of the ZHAW Zurich University of Applied Sciences\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba\",\"name\":\"Bruno Grazioli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g\",\"caption\":\"Bruno Grazioli\"},\"url\":\"https:\/\/blog.zhaw.ch\/icclab\/author\/gaea\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Managing ceilometer data in openstack - Service Engineering (ICCLab &amp; SPLab)","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/","og_locale":"en_US","og_type":"article","og_title":"Managing ceilometer data in openstack","og_description":"Ceilometer can collect a large amount of data, particularly in a system with large amount of servers and high activity: in such a scenario, the numbers of meters and samples can be large which \u00a0affects ceilometer performance and gives rise to quite large databases. In our particular case we are studying energy consumption in servers [&hellip;]","og_url":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/","og_site_name":"Service Engineering (ICCLab &amp; SPLab)","article_published_time":"2014-12-12T16:00:03+00:00","article_modified_time":"2014-12-16T08:29:37+00:00","author":"Bruno Grazioli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Bruno Grazioli","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#article","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/"},"author":{"name":"Bruno Grazioli","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba"},"headline":"Managing ceilometer data in openstack","datePublished":"2014-12-12T16:00:03+00:00","dateModified":"2014-12-16T08:29:37+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/"},"wordCount":802,"commentCount":1,"keywords":["Ceilometer","data","database","managing","mongo","openstack"],"articleSection":["Articles"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/","url":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/","name":"Managing ceilometer data in openstack - Service Engineering (ICCLab &amp; SPLab)","isPartOf":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#website"},"datePublished":"2014-12-12T16:00:03+00:00","dateModified":"2014-12-16T08:29:37+00:00","author":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba"},"breadcrumb":{"@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.zhaw.ch\/icclab\/managing-ceilometer-data-in-openstack\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/blog.zhaw.ch\/icclab\/"},{"@type":"ListItem","position":2,"name":"Managing ceilometer data in openstack"}]},{"@type":"WebSite","@id":"https:\/\/blog.zhaw.ch\/icclab\/#website","url":"https:\/\/blog.zhaw.ch\/icclab\/","name":"Service Engineering (ICCLab &amp; SPLab)","description":"A Blog of the ZHAW Zurich University of Applied Sciences","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.zhaw.ch\/icclab\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/blog.zhaw.ch\/icclab\/#\/schema\/person\/769a2455bfa3cbcc87857218f19abeba","name":"Bruno Grazioli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/07d475be0415d5914aa49599b3295e4d972f971e46f5d7ab89d474327ab7b5f0?s=96&d=mm&r=g","caption":"Bruno Grazioli"},"url":"https:\/\/blog.zhaw.ch\/icclab\/author\/gaea\/"}]}},"_links":{"self":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/7001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/users\/101"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/comments?post=7001"}],"version-history":[{"count":5,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/7001\/revisions"}],"predecessor-version":[{"id":7009,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/posts\/7001\/revisions\/7009"}],"wp:attachment":[{"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/media?parent=7001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/categories?post=7001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/tags?post=7001"},{"taxonomy":"features","embeddable":true,"href":"https:\/\/blog.zhaw.ch\/icclab\/wp-json\/wp\/v2\/features?post=7001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}