4

I have PRTG monitoring my servers and network. Some of my servers are Windows-based, and I would like PRTG to auto restart services in case they are stopped.

This can be done using the WMI Service sensor, but I have a challenge with this. It requires me to manually select which services to monitor. This is cumbersome and does not scale.

I would like to automatically discover services which satisfy a condition. E.g. that the Startup type of the service is set to "Automatic". That way, I could set the service to "Manual" in case I wanted to temporarily override the auto-restart.

Is this possible somehow?

1
3

i work with PRTG for some years now and i don't think it's possible out of the PRTG GUI.

There are 3 possibilities you have.

1) If you want to add the new WMI Service Sensore you can use the Search field to define a condition. But you only can filter Name, Description or state. So this will not really help you i think. (see Picture)

enter image description here

2) If you have some similar services which you want to monitor on different systems you can use the template or the clone funktion. But i think you will now this and so it will not help you very much. What really helped me often is the last one:

3) use the PRTG API. With the API you can create new Sensors via HTTP-Call. I used this option some times and it helped really a lot. With the API you can do many things you're missing in the web-GUI. So if i were you, i would check the Servers via Powershell. (Get-Service | Select * | ? Name -eq Spooler - only example) So you can define all kind of conditions and select the services you want. If you have them in an array for example you can easily make an HTTP-API Request. Example:

$wclient = New-Object System.Net.WebClient
$wclient.DownloadString('https://PRTGURL/api/duplicateobject.htm?id=12345&name=NAME&targetid=23456&username=USER&passhash=PASSWORD')

This is a example for duplication of an existing sensor. You need one existing WMI-Sensor for services and can then clone and modify the new one... i did this already with SNMP-Sensors. I Cloned them and then changed the UID to get a new sensor which now monitors the things i want...

You will find infos about PRTG API under "configuration" --> "PRTG API". Or under https://YOUR-PRTG-URL/api.htm?tabid=6

EDIT: You need two API-Calls: One for Cloning and one for manipulating / changing the Service-Name which you want to monitor.

When you want to select the services from many servers you can use PS-Remoting or also you may select them via WMI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.