Setting Up a Service Monitor

monitoring

We recently had cause to create a simple service to monitor another service, then send the status of the monitored service to application insights. In this article, I will highlight the steps required to get this installed and running on one a machine.

Download

You can download the code for the service monitor from GitHub here: https://github.com/deanobrien/service-listener-for-solr

In order to get it working:

  1. Clone the repo and rebuild
  2. Copy output from bin directoy
  3. Paste to location on target machine
  4. Install DotNet runtime on the target machine
  5. Open command prompt and navigate to “C:\Windows\Microsoft.NET\Framework\v4.0.30319“
  6. Install service by entering command: installutil "<enter path to output>/ServiceListener.exe"
  7. Add the following environment variables
    1. ServiceMonitorInstrumentationKey - instrumentation key for the app insights resource
    2. ServiceMonitorServiceName - needs to exactly match the service name being monitored
    3. ServiceMonitorInstanceName - display name (i.e. SOLR on UAT1)
    4. ServiceMonitorIntervalInSecs - delay between logging
  8. Start the service ServiceListener

Once the above is setup and running, you can then setup alerting to check for the presence of these custom events (i.e. SOLR on UAT2: Running).

Leave a Reply

Your email address will not be published. Required fields are marked *