Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This article describes how to create a single Action Profile that can start various Windows Services when up.time Uptime Infrastructure Monitor observes that a Windows Service has stopped.    

...

Alerts and Actions can be triggered in up.time Uptime Infrastructure Monitor when an Element changes state.  This is discussed in the up.time Uptime Infrastructure Monitor Administrator’s Guide here: Alerts and Actions.   Several actions are available out-of-the-box: Log to File, Recovery Script, Windows Service and SNMP trap. 

The Windows Service action can Start, Stop or Restart a Windows Service identified by name.  This is useful when you’ve created a Service Monitor using the Windows Service Check monitor to watch for a state change with a specific Windows Service.  A typical scenario would be to set a Critical Status if a specified Windows Service is Stopped.  In this case the Windows Service action in up.time Uptime Infrastructure Monitor could be used to automatically try to start the Windows Service in an attempt to minimize service disruption.

...

We are going to leverage a Recovery Script in an Action Profile to Start the Windows Service.  This will be a very simple script.  We are going to leverage two key components built into up.timeUptime Infrastructure Monitor:

  • First, the ability to create a script on the up.time Uptime Infrastructure Monitor Monitoring Station that directs an up.time Uptime Infrastructure Monitor Agent to perform an action.  In fact, the up.time Uptime Infrastructure Monitor Agent exposes a method to the up.time Uptime Infrastructure Monitor Monitoring Station to Start a Window Service – we simply have to supply the Windows Service name. 
  • Second, the use of Recovery Script Variables (variables available when creating Recovery Scripts).  These are variables handed into our script by up.timeUptime Infrastructure Monitor.

Here is what the Recovery Script looks like:

...

  • %UPTIME_HOSTNAME% is the name of the system raising the Alert, also the system where the Windows Service will be restarted.
  • %UPTIME_SERVICENAME% is the name of the Service Monitor we created earlier.  Note that this is why we needed the Service Monitor name to match the Windows Service Display Name.
  • The \” may look strange, this ensures the whole Windows Service name gets included regardless of spaces.
  • Changeme2 is the up.time Uptime Infrastructure Monitor Agent Password in this environment, your environment will differ.

This script is saved to the Scripts directory on the up.time Uptime Infrastructure Monitor Monitoring Station (default: C:\Program Files\uptime software\uptime\scripts).

...

If you are familiar with Action Profiles you may know that up.time Uptime Infrastructure Monitor has a built in Test Action Profile capability.  However, that won’t work in our case because the variables we are leveraging only get populated when a Service Monitor is triggered.

...

The Windows Service will be started in the security context of the up.time Uptime Infrastructure Monitor agent running on the system where the Windows Service is being started (by default Local System). 

This is only one way to accomplish this task, other viable options exist.  You could create an up.time Uptime Infrastructure Monitor Agent side script to perform the recovery, you could call a third party tool from the recovery script to start the service, etc, etc.