Hi all, I recently built a pfSense router, and installed the Telegraf package to write metrics to my InfluxDB. However, the base Telegraf package for pfSense does not have a measurement for CPU Temperature. So, I figured I could add an inputs.exec entry to the "additional configuration for Telegraf" box.
Here's what I entered: <pre> [[inputs.exec]] commands = ["sysctl -n dev.cpu.0.temperature | tr -d 0.C"] name_override = "cpu_temp" timeout = "5s" data_format = "influx" [inputs.exec.tags] cpu = "cpu0"</pre>
However, this does not result in a new measurement. As far as I can tell, it's doing nothing. I know that user account access can be an issue, but as far as I can tell there is only one user on my pfSense, and that user has full administrator access. Can anyone point me in the right direction?
This makes perfect sense... I was a little confused about the data_format, and this clears that up. Also, thank you for your note about the tr command. I did choose to trim 0.C because it appears those values are always whole numbers, however it occurred to me that if it ever returned a decimal value, my command would no longer work. I think I will change it to trim off only the C, and set the data_type to float.
With that said, I've made the suggested changes and restarted pfSense, but unfortunately the measurement is still not showing up. Seems like there must be something else wrong.
Are there any logs in pfSense that might tell me what is happening? I looked around in the system log, but I didn't see anything.
If there is output that looks like the following, then you just need to debug your configured output: ``` cpu_temp,cpu="cpu0" cpu_temp=41.0 123498762134 ```
Regarding logging, it depends on your config file. I'm not sure where pfsense's telegraf config has the logs going to. I manually installed telegraf on my pfsense box. [This telegraf issue](https://github.com/influxdata/telegraf/issues/5665) has some good conversation regarding telegraf on pfsense.
Thanks, I'll give this a try when I get home tonight. If you can point me in the right direction for how to run telegraf manually from the shell, that would be helpful! However, I'm sure I can google my way there if I need to!
Well, I ran telegraf manually per your instructions (thank you again for that!), and the result is the following error: <pre>Error in plugin [inputs.exec]: exec: exit status 4 for command 'sysctl -n dev.cpu.0.temperature | tr -d C': sysctl: unknown oid '|'... </pre>
Google isn't yielding much for "telegraf inpus.exec exit status 4"... any ideas?
can you try to put the commands in an executable script , with a shebang and all , and call the script in the inputs.exec plug-in ?The user Telegraf should have execute permissions on that script and you may have to specify the complete path in the commands parameter ..