What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Is it possible to use the WMI Service Sensor for Monitoring stopped Services?

Votes:

0

Hello,

usualy the WMI Service Sensor is Monitoring if a Service is running. In our Case we go some Service, that have to be stopped. Is it possible to use the WMI Service Sensor the other way and only showing warnings and errors, if these Services are running?

Thanks. :-)

service services wmi-sensors wmi-service

Created on Nov 18, 2015 8:37:20 AM



4 Replies

Accepted Answer

Votes:

6

Hi Martin

i know you asked about using WMI. But I use a custom sensor VBS Script I adapted to check if a process is running which shouldn't (in our case dropbox.exe) I am quite sure you can use this to check if the service is not running. regards Thomas

on error resume next

' Commandline Argument is process.exe
' ex: cscript getprocess.vbs explorer.exe
' **************************************
strComputer = "."

if isNull(WScript.Arguments.Item(0)) then
	wscript.echo "Process not given -> getprocess.vbs processname.exe"
	wscript.quit
else
	strProcess = WScript.Arguments.Item(0)	
end if

strComputer = WScript.Arguments.Item(1)


Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery( _
    "Select * from Win32_Process WHERE name ='"&strProcess&"'")

if colItems.Count < 1 then	
	Wscript.Echo colItems.Count&":Ok" 
	Wscript.quit("0")
ELSE
	wscript.echo colItems.Count&":processes running"
	wscript.quit("1")
	
end if

Created on Nov 18, 2015 4:28:06 PM



Votes:

0

Hi Thomas,

thank you. I'm not so familiar with VB, but I will try to figure out how to integrate your script and let you know the result. :-)

Regads Martin

Created on Nov 19, 2015 9:19:02 AM



Votes:

0

Ahhh, Thomas.

It's the first time I used VB in PRTG and didn't saw the possibility, to simply add the name of EXE-File under "Parameter" of the Sensor. :-) It seems to run! :-D

Thank you!!! ;-)

Cheers Martin

Created on Nov 19, 2015 9:25:52 AM



Votes:

0

@Martin Bitte gern geschehen ;)

cheers Thomas

Created on Nov 19, 2015 2:23:03 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.