I’ve just found Telegraf and I’m really impressed! However, I’ve set it up on a pair of Raspberry Pis and I’m seeing odd behaviour.
With identical configuration, one Pi is not sending the netstat metrics to InfluxDB, but the other is. Similarly, the one that is sending netstat metrics is not sending one of my two input.exec metrics, but the first is.
Focusing on the input.exec plugin (because I’ve got a bit more control over that), when I run telegraf on the command line (including running it as the telegraf user to prove there’s no permissions problems) the input.exec plugin data is gathered and posted to InfluxDB. However, when I “systemctl start telegraf.service” the data for that one plug-in isn’t collected/sent. I’ve even run up Wireshark on the InfluxDB and I can see that that one metric isn’t being posted. I’ve added to the script my input.exec calls to ‘tee’ to write to a file as well as returning it’s data, and I can see that, when telegraf is running as a service, the input exec script isn’t being run. I’ve disabled EVERY input plugin except the problematic one and in the log when running as a service I see “I! Loaded inputs: inputs.exec”, but after that I only see "D! Output [influxdb] buffer fullness: 0 / 10000 metrics. "
I’ve enabled debugging/logging to file, and there are no error messages logged about the failing plug-in when running as a service. With no error messages I’m at a bit of a loss as to how to continue.
The two Pis are running the version from the Jessie Apt repository, telegraf v1.2.1-1. The InfluxDB server is running on an Ubuntu 16.04 box, version 1.2.2-1.
Here’s my config for the inputs.exec plugin
[[inputs.exec]] commands = ["/home/dave/w1_temp/pi_gpu_gather_telegraf.sh"] name_override = "gpu_temp" data_format = "value" data_type = "float" # required interval = "120s"
And here’s the bash script it’s supposed to be calling (which I’ve proven does work from the command-line as the telegraf user)
#!/bin/bash vcgencmd measure_temp | sed 's/.*=\(.*\).C/\1/g' | tee -a /tmp/gpu.log
If someone could point out what I’m doing wrong, I’d really appreciate it.