Follow the following steps to monitor a service and have it restarted automatically by SCOM if it fails.
- Create a management pack to store the monitor in
- Create a group that the monitor will be applied against
- Create a monitor that watches the service
- Create overrides (apply to group)
- Create the recovery task
In the managment console under Administration right click on Management Packs and select “Create Management Pack”. Give this new MP a meaningfull name and continue.
Step 2: Create the Group
- In the Authoring Pane right click on “create new group” Give this new group a meaningful name. A description. And select the management pack that you created.
Important: Do not use the default management pack. You can do it. But this will create problems when trying to remove MP in the future. Always use Custom MP’s.
- Say next. Click on Add/remove objects on the Explicit Group Members. Enter a server name and search. Select your computer object and say ok. You can now add dynamic and exclusions. I am not going into that on this post so except all defaults.
Step 3: Create the Monitor
- In the Authoring Pane right click on monitors and select Create a monitor, then Unit Monitor.
- Expand Windows Services, and select “Basic Service Monitor”. Select the custom management pack.
- Provide a name for the monitor. I am going to create this monitor to watch Windows Update services. Select the monitor target as windows Server Operating System. Select the Parent Monitor as Availability.
- Next Browse to the server, or any server with the service running. and select the service.
- The next window shows how the monitor sees the health state. Accept the default.
- The last window is how the alerts are configured.
- uncheck the “Generate alerts for this monitor:” for now. This will prevent any unwanted alerts until we are ready.
Lets apply this MP against the group that we created earlier and disable it for all other servers.
Fist disable the rule for all servers
- Find the new rule under Authoring\monitors. The easiest way to do this is to change your scope. Click on the Change scope in the top right corner
- Look for windows server operating System and select it and say ok.
- Expand the monitor, right click on it and select properties.
- Select Disable and “For all objects of type: windows Server Operating System”
- Next Right click on the same monitor and select override, Override the Monitor, for a group
- Start to type the name of the group you created and select it.
- Place a check beside “Parameter name”. Change the override setting to True. This will enable the rule for the group.
- Say OK to save.
- In the Authoring Pane right click on monitors and select the monitor you created by right clicking on it and select properties.
- Click on the Diagnostic and Recovery Tab
- Under the configure recovery Tasks select Add… and choose “Recovery for Critical Health State”
- Select Run command
- Provide a meaningful name and description
- Select the recovery target as Windows server operating system
- Check run recovery automatically and recalculate monitor state.
- Next, for the full path to the file type C:\WINDOWS\system32\net.exe This will spawn the net command
- for the parameters type start service name. We are starting windows update service. Here is the best way to find the service name. Open services by opening the run box and type services.msc
- now that you have the actual service name lets enter it in the parameters field. so you would type “Start wuauserv”
- Once you have clicked on create you are done.