Hello influxGurus,

I would like to check if a service is running. I created a vbscript:




















*Dim strComputer,strServiceNamestrComputer = "."strServiceName = 
"w32time"if isServiceRunning(strComputer,strServiceName) then        
wscript.echo "check" & "_" & strServiceName & " value=1"else        
wscript.echo "check" & "_" & strServiceName & " value=0"end iffunction 
isServiceRunning(strComputer,strServiceName)        Dim objWMIService, 
strWMIQuery        strWMIQuery = "Select * from Win32_Service Where Name = 
'" & strServiceName & "' and state='Running'"        Set objWMIService = 
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & 
"\root\cimv2")        if objWMIService.ExecQuery(strWMIQuery).Count > 0 
then                isServiceRunning = true        else                
isServiceRunning = false        end ifEnd function*

Depending of the running state, the output is *check_w32time value=0* or 
*check_w32time 
value=1*.

My telegraf.conf is:

[[inputs.exec]]
    commands = ["cscript /nologo check_w32time.vbs"]
    timeout = "5s"
    name_suffix = "_mycollector"
    data_format = "influx"

However I'm not able to get the value. The log says : 
. 
*2017-02-21T10:26:40Z E! ERROR in input [inputs.exec]: Errors encountered: 
[exec: exit status 1 for command 'cscript /nologo check_w32time.vbs']*

Do you know how I could fix this or which solution I could use to retrieve 
the status of my service ?

Thank you in advance

Thierry

-- 
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 [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/8b1c9c2e-fc1c-4779-91d3-c504857e727a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to