{"id":1056,"date":"2022-12-10T18:25:05","date_gmt":"2022-12-10T18:25:05","guid":{"rendered":"https:\/\/thomas.w-p.me.uk\/blog\/?p=1056"},"modified":"2022-12-10T18:27:13","modified_gmt":"2022-12-10T18:27:13","slug":"influxdb-and-grafana","status":"publish","type":"post","link":"https:\/\/thomas.w-p.me.uk\/blog\/2022\/12\/influxdb-and-grafana\/","title":{"rendered":"influxdb and grafana"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"464\" src=\"https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-1024x464.png\" alt=\"\" class=\"wp-image-1057\" srcset=\"https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-1024x464.png 1024w, https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-300x136.png 300w, https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-768x348.png 768w, https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-1536x696.png 1536w, https:\/\/thomas.w-p.me.uk\/blog\/wp-content\/uploads\/2022\/12\/image-2048x929.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">grafana<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I have long wanted historical data on temperatures. Not sure why, but it might be interesting. Enter the influxdb persistence plugin and grafana (now I need to work out how to back them up too I guess).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Backing up influxdb turns out to be easy and I will add this to <a href=\"https:\/\/thomas.w-p.me.uk\/blog\/2022\/12\/backing-up-openhabian\/\" data-type=\"post\" data-id=\"1050\">the backup script<\/a>:<\/p>\n\n\n\n<pre class=\"wp-block-code has-beige-background-color has-background\"><code>influxd backup -portable -database openhabian \/mnt\/nas\/backup\/openhabian\/influxdb<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">rpi can just about run inlfuxdb 1.6 and can be installed by apt, and was enough. I just followed the instructions below then set it up in OpenHAB. I then had to work out how to actually store information in teh database. grafana was much easier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Influxdb notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.influxdata.com\/influxdb\/v1.6\/introduction\/installation\/\">https:\/\/docs.influxdata.com\/influxdb\/v1.6\/introduction\/installation\/<\/a> but I used <em>apt <\/em>then followed the configuration instructions<\/li>\n\n\n\n<li>You need to go in to the CLI and create a database, user and password which are then configured in openhab.<\/li>\n\n\n\n<li>Then edit \/etc\/openhab\/persistence\/influxdb.persist &#8211; not sure about the line &#8220;Temperature* : strategy = everyHalfHour, everyChange&#8221;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-beige-background-color has-background\"><code>sudo vi \/etc\/openhab\/persistence\/influxdb.persist <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">influxdb.persist<\/h3>\n\n\n\n<pre class=\"wp-block-code has-beige-background-color has-background\"><code>Strategies {\n    everyMinute : \"0 * * * * ?\"\n    everyHour   : \"0 0 * * * ?\"\n    everyHalfHour       : \"0 0,30 * * * ?\"\n    everyDay    : \"0 0 0 * * ?\"\n\n    default = everyChange\n}\n\nItems {\n    Tasmota4Fridge_Tas04PowerNow  : strategy = everyMinute\n    Tasmota2_Watts  : strategy = everyMinute\n    EMONPIMQTTThing_HousePowerwatts : strategy = everyMinute\n    KitchenEvohome_Temperature : strategy = everyHalfHour, everyChange\n    MasterBedEvohome_Temperature : strategy = everyHalfHour, everyChange\n    Tasmota01PowerNowW : strategy = everyMinute, everyChange\n    Tasmota3TVStack_Tasmota03PowerNow : strategy = everyMinute\n    WeatherandForecast_OutdoorTemperature : strategy = everyHalfHour, everyChange\n    emonpiMQTTThing_EmonPiExternelTemp : strategy = everyHalfHour, everyChange\n    SnugThermostat_Temperature : strategy = everyHalfHour, everyChange\n    Temperature* : strategy = everyHalfHour, everyChange\n\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">grafana notes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I just did all this then set up influxdb and created some graphs:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/grafana.com\/tutorials\/install-grafana-on-raspberry-pi\/\">https:\/\/grafana.com\/tutorials\/install-grafana-on-raspberry-pi\/<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There is no obvious backup solution yet, but I will explore this: <a href=\"https:\/\/github.com\/ysde\/grafana-backup-tool\">https:\/\/github.com\/ysde\/grafana-backup-tool<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have long wanted historical data on temperatures. Not sure why, but it might be interesting. Enter the influxdb persistence plugin and grafana (now I need to work out how to back them up too I guess). Backing up influxdb turns out to be easy and I will add this to the backup script: rpi &hellip; <a href=\"https:\/\/thomas.w-p.me.uk\/blog\/2022\/12\/influxdb-and-grafana\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">influxdb and grafana<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,104],"tags":[],"class_list":["post-1056","post","type-post","status-publish","format-standard","hentry","category-geekiness","category-openhab"],"_links":{"self":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":2,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"predecessor-version":[{"id":1059,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions\/1059"}],"wp:attachment":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}