Telegraf: can we use powershell script in telegraf?

Created on 11 Nov 2016  路  7Comments  路  Source: influxdata/telegraf

[[inputs.exec]]
commands = ["D:TealeafSystemcanisterstats.ps1"]
timeout = "30s"
data_format = "influx"
name_suffix = "_expPlusCan"

am getting below error :
C:Program FilesTelegraf>telegraf -config telegraf.conf -test
Error parsing telegraf.conf, toml: line 131: parse error

this is line 131 -- commands = ["D:TealeafSystemcanisterstats.ps1"]

Most helpful comment

You need to escape your backslash in your commands path. Use double backslash instead \\

commands = ["D:\\Tealeaf\\System\\canisterstats.ps1"]

All 7 comments

You need to escape your backslash in your commands path. Use double backslash instead \\

commands = ["D:\\Tealeaf\\System\\canisterstats.ps1"]

Thanks puckpuck.. Still error.. changed from ps1 to bat :-(

[[inputs.exec]]
commands = ["D:TealeafSystemcanstat.bat"]
timeout = "30s"
data_format = "json"
name_suffix = "_expPlusCan"

2016/11/12 04:39:53 Errors encountered: [exec: exec: "D:TealeafSystemcanstat.bat
": file does not exist for command 'D:TealeafSystemcanstat.bat']

commands = ["D:/Tealeaf/System/canstat.bat"] --- this one working !!!

Thanks for showing me a way ;-)

I am having the same issue: In my case
PS C:Program Filestelegraf> .telegraf.exe -config telegraf.conf -test
2017/03/23 17:48:50 E! Error parsing telegraf.conf, toml: line 179: parse error

And this is line 179: commands = ["C:/process.bat"]
I've tried commands = ["C:\process.bat"] as well and same issue.

@mananpatel Please take a look at this issue: #2230

@danielnelson Thanks. That worked lake a charm.

Try like this, i has the same issue and use '/' instead of '\' or '\\', it works.

[[inputs.exec]]
commands = ["D:/Tealeaf/System/canisterstats.ps1"]
timeout = "30s"
data_format = "influx"
name_suffix = "_expPlusCan"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grafanaUser123 picture grafanaUser123  路  3Comments

SongYg picture SongYg  路  3Comments

mrcheeky123 picture mrcheeky123  路  3Comments

mabushey picture mabushey  路  3Comments

robert-gomes picture robert-gomes  路  3Comments