I’ve decided to write a series of articles covering some of the tasks that could be helpful to the newer Operations Manager administrators.
This article will cover how to create a custom service monitor and how to implement an automatic service restart action associated with that service. In this example we will use the Print Spooler service.
Creating a custom service monitor:
First go to the authoring node of your console, you will see a section called Management Pack Templates, this is where we will create our custom service monitor.

Right click on Windows Service and select Add Monitoring Wizard.

On the first page of the wizard select windows service and click next.

Give your monitor a name and select the management pack that will be used to save it, you can also create a new management pack if required without leaving the wizard by clicking the New button to the right of the drop-down. Click next.

On this screen we need to provide the name of the service to be monitored. Targeting a group will also limit the service discovery to only the grouped service, this prevents unnecessary load on servers that do not have the service. Tick Monitor only automatic services only if the service has automatic start.

Clicking the “…” button will open the below window allowing you to search for the required service. You can connect to any server using the “…” button next to Computer name.
Select the service and press OK.

Once the service details are populated click next.

If you need to monitor performance of the service such as memory or CPU utilisation you can configure that here. If it’s not required just click next.

The wizard will now display a final summary for your service monitor. Check everything is correct and click create.

Creating an automatic start service recovery:
Once your monitor has been created, right click on the service, select View Management Pack Objects and then Monitors.

On the monitors page expend the nodes until you find Service Running State, right click on the one that is listed in the same management pack from earlier and choose properties.

In the monitor properties click on the Diagnotic and Recovery tab, click Add under Configure recovery tasks and then select Recovery for critical health state.

Choose Run Command. Click next.

Give the recovery action a name and tick Recalculate monitor state after recovery finishes. Click Next.

In order to start the service we will use the Net Start command, in full path to file enter the complete path c:\windows\System32\net.exe, next fill in the parameters field, begin with Start followed by the name of your service, in this case Start Spooler.
Note: If the service name contains spaces it is important to enclose the service name in quotes. For example “NetBackup Client Service”

Click create and close the monitor properties.
And there you have it, a custom service monitor with an automatic recovery action.