Using PRTG to monitor your Windows server using native sensors is really super easy. In addition to sensors such as CPU, RAM or hard disk space, the surveillance of automatically started services is an essential aspect of monitoring – and this can be really annoying if you use the built-in components. To work around this problem, I created a script that does just that: It checks all automatically starting services of the monitored Windows operating system and reports should any of them not be running.
Automatic services and automatic services
You might think that automatically started services should always run in Windows – but that’s not always true. In fact, depending on your operating system version and installed software, there are services that are configured to start automatically, but are only launched on demand. Most of the time they don’t run.
You all know the server manager of a freshly installed Windows Server 2016: There a red exclamation mark jumps at us that a service is not started, the „Downloaded Maps Manager“ (you can find more information here). So we have to be able to distinguish between automatically started services and automatically started services in our monitoring. Some of these are generally valid exceptions, like the „Maps Manager“ described above, othersryour exceptions per server, like the „Notifications Broker“ in Microsoft Exchange.
There is already a script by Paessler that does almost everything as I expect it to. On this basis I created and extended my script. The most important differences between Paessler’s solution and mine are:
- Internal service name instead of display name – The display name of a service depends on the language of the operating system. In a mixed environment (e.g. German and English installations) this can be difficult. Therefore I use the internal service name for the scan exclusions.
- Regular Expression Support – There are Windows services with names that are different on each system based on a unique ID (such as Sync Host or .NET Optimization). Using regular expressions, only one exception is required to exclude it from the scan.
My script is integrated in PRTG as „Custom Sensor / EXE/Script“ and needs only a few settings. You can find it together with the exact settings and parameters on Github or in the PRTG Script World. There you can find a description on how to set up the sensor and where to put the scan exclusions. Once the setup is complete, the result will look similar to the one shown in the picture above.
I hope you find this sensor useful for your environment (I always use it in new deployments I do). If you find any issues or miss features, please leave me a comment, file a bug in Github or contact my in any other way. Happy monitoring!