What is the best way to monitor a windows service?
Creating the monitor with the standard windows service template or Lior Armiev’s template for more services, both targeted to a created group of servers
OR
Creating all with the fragments in MP Studio by first discovering a class and then targeting the monitor to this class. Here is no way to monitor more service with a wildcard.
I’ve personally found the standard windows service template to serve our needs 90% of the time. If I’m bundling the service as part of a new application role or object, I might create a fragment to link with it, but that’s been pretty rare. For wildcard services, I still use the standard template but then manually modify the MP XML for discovery:
<DataSource ID=“DS” TypeID=“Windows!Microsoft.Windows.WmiProviderWithClassSnapshotDataMapper”>
<NameSpace>root\cimv2</NameSpace>
<Query>select * from win32_service where displayname like ‘%wilcardservicestring%’</Query>
We don’t touch any of the templates due to the extra baggage that gets created e.g. classes and performance metrics.
The way we create the monitoring is to separate the application from the infrastructure. So create a class based on local application with a hosting relationship to windows computer but no health roll up.
I use fragments. For pretty much everything. You can use VSAE or MPStudio
Create the discovery for the class (https://blogs.technet.microsoft.com/kevinholman/2016/06/04/part-2-use-vsae-fragments-to-dynamically-discover-an-application-based-on-the-existence-of-a-registry-key-or-value/
Create the Service monitor: https://blogs.technet.microsoft.com/kevinholman/2016/06/04/part-3-use-vsae-fragments-to-monitor-a-service/
Document Management pack. Sure it's one service but I have a template doc I use for this. It has the name of the requester, the ticket requesting the monitor, the basic structure of the monitor, and the alert. This documentation helps when someone asks two years later why/if a monitor is still needed. I can point to documentation and let them decide.