Discussion:
[influxdb] trying to create inputs.exec fails
r***@controlup.com
2018-01-10 16:51:14 UTC
Permalink
Hii all,

Using latest telegraf (1.5), I am trying to add the output of ps -aux to
the telegraf via inputs.exec

my inputs.exec :

[[inputs.exec]]
commands = [ "/bin/bash /opt/processes.bash" ]
timeout = "5s"
data_format = "json"


/opt/processes.bash :

/bin/ps aux | jq -sR '[sub("\n$";"") | splits("\n") | sub("^ +";"") |
[splits(" +")]] | .[0] as $header | .[1:] | [.[] | [. as $x | range($header
| length) | {"key": $header[.], "value": $x[.]}] | from_entries]'



i do not see the info in the outputs.file (i created an output json file to
see the data, but i is not there).

What am i missing ?

Regard,

Ronen
--
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/004bfebe-7722-42a1-9120-c3608175be89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
r***@controlup.com
2018-01-10 16:55:25 UTC
Permalink
BTW,

i can see that my script is running every 10 sec. (i added an echo to a
file with a date).

tail -f /tmp/mytest.txt

telegraf 2018-01-10_16:53:40
telegraf 2018-01-10_16:53:50
telegraf 2018-01-10_16:54:00
telegraf 2018-01-10_16:54:10
telegraf 2018-01-10_16:54:20


so it is not a permission issue.
Post by r***@controlup.com
Hii all,
Using latest telegraf (1.5), I am trying to add the output of ps -aux to
the telegraf via inputs.exec
[[inputs.exec]]
commands = [ "/bin/bash /opt/processes.bash" ]
timeout = "5s"
data_format = "json"
/bin/ps aux | jq -sR '[sub("\n$";"") | splits("\n") | sub("^ +";"") |
[splits(" +")]] | .[0] as $header | .[1:] | [.[] | [. as $x | range($header
| length) | {"key": $header[.], "value": $x[.]}] | from_entries]'
i do not see the info in the outputs.file (i created an output json file
to see the data, but i is not there).
What am i missing ?
Regard,
Ronen
--
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/5e0fccc4-2691-493a-88b5-982a764d79b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...