{"id":249,"date":"2020-04-04T22:30:46","date_gmt":"2020-04-04T13:00:46","guid":{"rendered":"https:\/\/sighmon.com\/says\/?p=249"},"modified":"2020-04-04T22:31:41","modified_gmt":"2020-04-04T13:01:41","slug":"storing-sensor-data","status":"publish","type":"post","link":"https:\/\/sighmon.com\/says\/storing-sensor-data\/","title":{"rendered":"Storing sensor data"},"content":{"rendered":"\n<p>Today I started looking into installing <a href=\"http:\/\/INFLUXDB_TIME_BETWEEN_POSTS\">Prometheus<\/a> on <a href=\"https:\/\/heroku.com\">Heroku<\/a> (a platform as a service provider), and soon realised that Prometheus saves its data to the filesystem. Cool if you have your own server with a bunch of disk space, but not so great for Heroku that specialises in read-only secure filesystems.<\/p>\n\n\n\n<p>Prometheus does also have the ability to save to a remote <a href=\"https:\/\/prometheus.io\/docs\/operating\/integrations\/#remote-endpoints-and-storage\">PostgreSQL\/TimescaleDB database<\/a>, but while looking into that, a friend&#8217;s recommendation of <a href=\"https:\/\/www.influxdata.com\">InfluxDB<\/a> popped into my mind.<\/p>\n\n\n\n<p>The big difference between the two is that Prometheus <strong>scrapes<\/strong> data from devices, where InfluxDB relies on the devices <strong>posting<\/strong> their data.<\/p>\n\n\n\n<p>Because I&#8217;m at the early stages of this project, I thought it might be nice to see if I could get the Enviro+ exporter to do both.<\/p>\n\n\n\n<p>I decided to setup an <a href=\"https:\/\/www.influxdata.com\/products\/influxdb-cloud\/\">InfluxDB-Cloud<\/a> account, which is free for:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Write up to 5MB\/5 minutes<\/li><li>Data retention of 30 days<\/li><li>Up to 10,000 series of data<\/li><\/ul>\n\n\n\n<p>A little hacking later, and I now have a <a href=\"https:\/\/github.com\/sighmon\/enviroplus_exporter\/tree\/add\/2-influxdb-support\">branch setup with the InfluxDB functionality<\/a>.<\/p>\n\n\n\n<p>Success! I&#8217;ll leave it running a while and see how it performs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"806\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-1024x806.png\" alt=\"Success! Enviro+ is now posting its sensor data to InfluxDB Cloud.\" class=\"wp-image-256\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-1024x806.png 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-300x236.png 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-768x605.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-1536x1209.png 1536w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-2048x1612.png 2048w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2020\/04\/influxdb-adelaide-1568x1234.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Success! Enviro+ is now posting its sensor data to InfluxDB Cloud.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Choosing a timeseries database to store lots of air quality sensor data.<\/p>\n","protected":false},"author":1,"featured_media":256,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59,9],"tags":[64,62,61,60,63],"class_list":["post-249","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-databases","category-sensors","tag-data","tag-databases","tag-influxdb","tag-prometheus","tag-sensor","entry"],"_links":{"self":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/comments?post=249"}],"version-history":[{"count":8,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/249\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/249\/revisions\/259"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media\/256"}],"wp:attachment":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media?parent=249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/categories?post=249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/tags?post=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}