Shell script is not working in telegeraf

I had a script to know the https status


for url in “${urls[@]}”; do
response=$(curl -s -L -I -k -o /dev/null -w “%{http_code}” “$url”)
if [ “$response” = “200” ]; then
echo “$url” “$status”

and the plugin i used in telegraf is

name_suffix = “curl_status”
commands = [“sh /root/”]
data_format = “influx”

i’m not able to get the output in telegraf debug command

The format of your data from the script is not in line protocol. If you wish to use line protocol, please see InfluxDB line protocol tutorial | InfluxDB OSS v1 Documentation

Or consider switching to the value format and returning only the status.

Additionally, consider using the HTTP repsonse plugin:

If I try to run the script the output will show like below" Success” Success” connection failed

how i want to display the script output as output through telegraf .
And while debugging the telegraf the .exec plugin is showing there .

So why don’t you just use the http_response input plugin as @jpowers mentioned?

As per the requirement they told that they want the output of that script only based on that they are working on different things .

Maybe the PATH variable is not set in telegraf’s environment. Have you tried changing the invocation of executables (sh, curl) to absolute paths?