t***@gmail.com
2018-07-17 18:13:44 UTC
Hi,
I am attempting to setup an exec module to execute a script under another user. Unfortunately I have no other solution because this other user has the necessary credentials configured, and I cannot use telegraph user to run the script directly.
Here is what I currently have:
actual_script.py
actual_script_wrapper.sh
output_file
And the exec module is configured as below:
[[inputs.exec]]
command = "/opt/actual_script_wrapper.sh"
interval = "5m"
data_format = "influx"
The actual script saves the output that I wish to be returned to Telegraf, and in the wrapper script, I have:
/bin/echo "" > /opt/output_file
/bin/chmod 666 /opt/output_file
/usr/bin/sudo -u actual_user /opt/actual_script.py
/bin/cat /opt/output_file
All permissions and SUDOer file is configured. This also executes successfully when I ran the test:
sudo -u telegraf telegraf --config-directory=/etc/telegraf --test --input-filter=exec
However, when executing from the telegraf service the output_file is always empty, which seemed to me that the actual_script is not being executed.
Has anyone tried to do something similar? If anyone can provide any insight it would be very much appreciated.
Thanks.
I am attempting to setup an exec module to execute a script under another user. Unfortunately I have no other solution because this other user has the necessary credentials configured, and I cannot use telegraph user to run the script directly.
Here is what I currently have:
actual_script.py
actual_script_wrapper.sh
output_file
And the exec module is configured as below:
[[inputs.exec]]
command = "/opt/actual_script_wrapper.sh"
interval = "5m"
data_format = "influx"
The actual script saves the output that I wish to be returned to Telegraf, and in the wrapper script, I have:
/bin/echo "" > /opt/output_file
/bin/chmod 666 /opt/output_file
/usr/bin/sudo -u actual_user /opt/actual_script.py
/bin/cat /opt/output_file
All permissions and SUDOer file is configured. This also executes successfully when I ran the test:
sudo -u telegraf telegraf --config-directory=/etc/telegraf --test --input-filter=exec
However, when executing from the telegraf service the output_file is always empty, which seemed to me that the actual_script is not being executed.
Has anyone tried to do something similar? If anyone can provide any insight it would be very much appreciated.
Thanks.
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/1a419be2-3c85-41c6-b84d-9c9c9b010d66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/1a419be2-3c85-41c6-b84d-9c9c9b010d66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.