New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


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

Votes:

0

Your Vote:

Up

Down

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 by  Martin Neumann (0) 1



4 Replies

Accepted Answer

Votes:

6

Your Vote:

Up

Down

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 by  Thomas Umbricht (2,820) 2 3



Votes:

0

Your Vote:

Up

Down

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 by  Martin Neumann (0) 1



Votes:

0

Your Vote:

Up

Down

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 by  Martin Neumann (0) 1



Votes:

0

Your Vote:

Up

Down

@Martin Bitte gern geschehen ;)

cheers Thomas

Created on Nov 19, 2015 2:23:03 PM by  Thomas Umbricht (2,820) 2 3



Please log in or register to enter your reply.


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.