Telegraf inputs.exec plugin

Hi there,
Can someone help me with the Telegraf inputs.exec plugin ?
Currently I’m facing an issue with running bash commands that check the kernel version.
Here is my commands

commands = ["/bin/bash -c \"version_check=$(uname -a | awk '{print $3}') && echo \"tag=tag\" kernel_version=\"${version_check}\"\""]
data_format = "influx"

And I’m always receiving this error in log

[inputs.exec] Error in plugin: metric parse error: expected field at 1:16: “tag=tag kernel_version=5.10.63-v7l+”

Hello @menvol3,
Welcome! Your output has to be in line protocol:

I find using the --test flag helpful when debugging telegraf because it’ll send your attempts to STDOUT so you can read your “line protocol” and more easily see what’s missing.

So far it looks like your line protocol is missing:

  • a measurement (unless you want your measurement to be tag with a measurement value of tag which is confusing)
  • a more useful tag or no tag
  • quotes surrounding the field value “5.10.63-v7l+”
1 Like