Config Info
Name Windows Service Discovery
Version 1.0

About

One of the most common and repetitive tasks in Operations monitoring implementation is Windows Service Monitoring. The involved tasks are usually:

  1. asking the customers which services are installed on the server
  2. which ones are important
  3. what is the name of the service (which is actually different from the one appearing in Windows Service Manager), that is: connect to the server, open Service manager, right-click on the service to get its information etc etc... repeated 3 billion times  :)
  4. correcting spelling mistakes (uppercase instead of lowercase or things like that)

and then copying/pasting/renaming monitors... this lets lots of space for mistakes to creep in.

To workaround all these issues, we created an advanced monitor that actually generates exportation files containing other monitors. This is how it works:

  1. the generator monitor connects to a windows server and retrieves the list of services running on that server (the Windows Service Datasource actually knows how to do that)
  2. based on a template, it generates an .exp file containing Windows Single Service monitors configured for each of the services
  3. you can now import the generated file, and select only the services you are interested in.

Files used

To use these configurations, unzip the attached file in the ThinkServer installation folder (the folder AutomaticGeneration should be directly in the ThinkServer folder). These configurations use several concepts:

  • generator: a generator is and advanced monitor that can create monitor exportation files (thanks to Python \o/). They are located in the Generators folder
  • template: a template is the model that serves as a base for the monitors generated by the generator. The generation is based on Python string substitution, this is why you will find placeholders that look like %(DatasourceName)s . They are located in the Templates folder
  • generated monitors: a generator generates an .exp file containing one or more monitor configurations. The files will be created in the AutomaticGeneration folder.

How to use it

This is what it would look like in real life:

1. import the generator for Service Discovery - you may need to update the datasource to point to the server you are interested in (this monitor can easily be migrated with the MigrateConfigurations Utility if you think it is necessary). When you start it, id gives the following message. (it is important to configure the datasource properly as the generated monitors will also use that datasource):

it is the "Preview" mode, that is, it just tells you what it is going to do, and is not generating anything so far. (in the current configuration, it only lists the services that are configured with Automatic start and are currently started)

2. if that's ok for you, you can switch to "File generation mode", setting True in the Additional Parameters tab:

3. restart the monitor: it is now creating the exportation file, based on the template:


4. A file has been created in the AutomaticGeneration folder

5.You can import it in ThinkServer, selecting only the services you are interested in

Important

It is extremely important to check the options "Reuse datasources" and "Do not overwrite data sources", as the generated monitors need to use the datasource of the generator

6. That's all!

 

Editing the template

These monitors are based on a template for services monitor. If you want to create your own template (with customized health rules, or customized messages templates, or different name conventions for the monitors' names), here is the procedure:

1. create a Windows Single Service Monitor that suits your tastes

2. Once this is done, put in the "templates placeholders", that will be replaced at monitor generation times in the Monitor Name and in the Monitor Description.. it might look like this:

%(HostName)s - Service "%(ServiceDisplayName)s" (%(ServiceName)s) 

3. in the service filter, type in %(ServiceName)s

4. Once you are done, export the monitor (I suggest that the file should be called something like whatever.template.exp)

5. Edit the file with a text editor (Notepad ++ indeed), and modify the DataSource Name and Description to put in the DatasourceName placeholder:

6. update the Service generator to use that new template:

7. That's it!

Automatic Service discovery should work pretty well with Auto-provisioning configured in the SmartConsole! The same approach could be used for Windows Process or any kind of monitor...

See also

 


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: October 24, 2018