I am trying to check the telegraf.conf through [inputs.exec] plugin whether anyone modified the original conf file or not,but when i am adding the below [[inputs.exec]] into conf file under telegraf.d folder i am unable to start the telegraf service ,service getting failed.Could anyone assist me to resolve this issue.Thanks!
Hello @IncredibleOne,
Welcome! Can you please set debug=True and share the full logs? Wait, sorry. if this is a silly question, but what is your expectation of the output of the exec plugin? Please not that to write data to influx the output of the exec needs to be in one of the acceptable data formats.
I can’t be sure without the log, but I think the command string is causing the issue, it contains too many double quotes ("), nested into each other, which is probably wrong
Current command
commands = [“sh -c \ heckfile=”/etc/telegraf/telegraf.conf" hashorig="********************************"
Try this one instead (wrapped with single quotes)
commands = ['sh -c \ heckfile=”/etc/telegraf/telegraf.conf" hashorig="********************************'
note that using single quotes won’t allow you to use env variables inside the string
You could probably figure out the right escaping, but it would be much easier to just move the shell script into a separate script file and execute that script from the exec input.