Having previously moved my Telegraf instance to a Synology-hosted Docker environment, I’ve spent some time adding additional measures for tracking and visualization using Grafana. With that task, I recently discovered the Telegraf Exec plugin, which allows you to execute custom scripts for the purposes of collecting external data for ingress into InfluxDB (or any of the other Telegraf output options). To prove out this concept, I’m using a Bash script to connect to Fitbit and pull data from my Fitbit Blaze into InfluxDB.
As part of my Home Automation series, we configured a Grafana dashboard to display status and statistics about SmartThings devices, the local weather and more. A few months ago, I retired an 8+ year old Windows Server storage solution and replaced it with a new Synology DS1817+. I knew that I wanted to leverage Grafana to display health statistics about the Synology (disk temperatures, throughput, disk conditions, etc.)—something that I never took the time to setup for my Windows server. Thankfully, Synology’s DSM platform natively supports SNMP, and we can easily run Telegraf to monitor the SNMP data and log it in our previously created InfluxDB instance.
Grafana is an analytics platform that allows you to create rich dashboards, define alerting logic when values exceed specified ranges, and visualize your data across a number of different formats. You can get a good idea of the capabilities of Grafana by just clicking through the official and community submitted dashboards on the Grafana website. The beauty of Grafana is its ability to visualize incredibly complex data sets in a way that still looks really sexy.
If you're super interested in all the little details, you should absolutely go and check out the InfluxDB website, but in a nutshell, InfluxDB is a time series based data platform. Unlike other database platforms that store data based on a primary key that you define, InfluxDB uses a timestamp as the primary key for data points; I'm obviously over-simplifying this to make it a little easier to understand. InfluxDB supports the auto-expiration of data—think of this as a TTL on a DNS entry if that helps you—which automatically purges the data at the end of expiration. The other big advantage to InfluxDB is that any past experience you may have with say SQL, is applicable here. The query language and syntax of InfluxDB has a lot of similarities with SQL, and you'll see that when we get to Part 4 and build our first dashboard.
Back in the Home Automation Kickoff post, I talked about the power of the mFi Controller to record, trend, and analyze device and energy usage. One of the huge disappointments with Ubiquiti ending development of the mFi Controller was the end of development related to these capabilities. SmartThings has proven itself to be a fantastic platform for the integration and management of physical devices, but offers essentially no analytics around those devices. In this post, and the following series, we’ll look at integrating data analysis with SmartThings, and building a more data-driven home automation solution.