On Tuesday, August 2, 2016 at 1:06:06 PM UTC+3, [email protected] wrote:
> Hi all,
> 
> I'm trying to capture the json output of a python script using the Exec Input 
> Plugin. For some reason, I'm getting the following error when telegraf tries 
> to execute the script and collect the metrics:
> 
> ```
> telegraf_1   | 2016-08-02T09:43:00.360767123Z 2016/08/02 09:43:00 ERROR in 
> input [exec]: exec: exit status 1 for command '/home/myscript.py'
> ```
> 
> The relevant entry of telegraf.conf file loos like the following:
> 
> ```
> [[inputs.exec]]
>   command = "/home/myscript.py"
>   data_format = "json"
>   name_suffix = "_some_suffix"
>   timeout = "10s"
>   tag_keys = ["key", "unit"]
> ```
> 
> /home/myscript.py has execution permissions ('chmod +x') and outputs the 
> following:
> 
> ```
> {"key": "some_key", "value": 28.214, "unit": "ms"}
> 
> ```
> 
> I've checked that the exit status of running `/home/myscript.py` is 0.
> 
> 
> The weirdest part is that, if I run `$ telegraf -config /etc/telegraf.conf` 
> -test`, I get a successful output:
> 
> ```
> * Plugin: exec, Collection 1
> > exec_some_suffix,host=13ceb7312093,key=some_key,unit=ms value=19.539 
> > 1470132272694745614
> ```
> 
> Do you have any idea of what could be happening?

Hi,

I have not been able to reproduce this behavior with the latest beta of 
Telegraf.

It is likely that when you execute telegraf by invoking the binary from the 
command line (telegraf -config /etc/telegraf.conf) you are running it as your 
user who has privileges to execute the python script, while the telegraf 
service runs as user "telegraf", which may not have sufficient privileges to 
access /home/myscript.py

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
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/13d30e18-f16f-40cf-b7cc-fbbaf4d57891%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to