Well it’s been a little over two week and the Raspberry Pi 3 Model B weather station has held up; figured now would be a good time to go a little deeper into the setup. Telegraf has been solid in ingesting my JSON documents periodically, lets have a look at it’s SensorTag configuration: # cat /etc/telegraf/telegraf.d/sensor_tag.conf [[inputs.exec]] command = "cat /sensor_tag.json" data_format = "json" name_suffix = "_sensor_tag" interval = "60s" This telegraf configuration inserts the output of /sensor_tag.
Grafana 5.x Running on Raspberry Pi
Got around to upgrading my Raspberry Pi 3 Model B weather station with a newer version of Grafana, the Debian packages for ARM are hosted on Grafana’s download page under ARMv7 . Moving from a 2.x word to a 5.x has been impressive, most notably the drag, drop, and resize functionality. I’m still using InfluxDB and Telegraf to store and populate my time data points. Latest Raspbian’s (stretch) comes with Influx 1.
SensorTag data merged with Open Weather Maps
About a week ago I worked on SensorTag metrics with Grafana . This week had some interesting weather today here in Austin, and I wanted to see to visualize it as well. Luckily Open Weather Maps offers a free API for gather near real-time weather data based on city code. def __get_open_weather_data(): url_path = 'http://api.openweathermap.org/data/2.5/weather' api_key = '??????????' url = '%s?zip=73301&APPID=%s' res = requests.get(url % (url_path, api_key)) if res: if res.
Telegraf and missing CPU interrupts
As I’ve been playing around with Telegraf and Grafana , I’ve noticed CPU interrupts and context switches are not apart of the standard metric gathering. We know vmstat shows this information, and can be shown it in a easy processable list form: $ vmstat -s 1016888 K total memory 497920 K used memory 184412 K active memory 173296 K inactive memory 518968 K free memory 70276 K buffer memory 86416 K swap cache 522236 K total swap 88460 K used swap 433776 K free swap 18175 non-nice user cpu ticks 0 nice user cpu ticks 17799 system cpu ticks 172172 idle cpu ticks 7214 IO-wait cpu ticks 0 IRQ cpu ticks 2412 softirq cpu ticks 0 stolen cpu ticks 227755 pages paged in 986944 pages paged out 2353 pages swapped in 121572 pages swapped out 458705 interrupts 1467529 CPU context switches 1461773910 boot time 3456 forks I decided to hack together a little exec plugin for Telegraf using a Python script, running the script will get you standard out JSON:
Telegraf laptop battery plugin
Wanted to expand a little on my previous blog post Custom Telegraf Plugin , and decided to do a simple battery monitor. The end result looks something like this: I decided to read from the file /sys/class/power_supply/BAT0/capacity on my Ubuntu 14.04 machine, this file merely shows the current battery percent: # cat /sys/class/power_supply/BAT0/capacity 62 All that is needed is a little Python script for converting this output to JSON, my script outputs like this:
Custom Telegraf Plugin
I just started looking to InfluxDB and Telegraf for collecting data on a Linux machine, then visualizing it with Grafana . I’ve historically used collectd , statsite , and graphite to accomplish the same sort of task, but wanted to see how some of the new software compares. I’m running a Ubuntu 14.04 LTS virtual machine, so feel free to follow along. I managed to install the packages from the InfluxDB ubuntu repositories :