My general stuff. This will generally include computer related information, but may also contain general rantings on my part.

Monday, May 19, 2008

Creating a SCOM MP using the Authoring Console

When setting up monitors, I have found that the toolset provided to me in the SCOM Admin console doesn't provide me with all the necessary functions desired.

Specifically, if I want to monitor a service, I have the option of using the service monitoring wizard – this doesn't provide much flexibility for future configuration, doesn't give the nicer UI functionality for the operators, and is just ugly if I make more than 2 or 3 of them. Alternatively, I can configure a service monitor to look for a service on all servers in a group – this assumes a group is already created, it doesn't perform any discovery, and still doesn't provide the UI functionality the operators will expect.

This leaves me with the requirement of using the MP Authoring Console and configuring all these options there. This means I need to: Create a class, create a discovery for the class, create groups and group populators, create the UI elements, and lastly create the monitors.

Configuring the console

Copy all MPs locally

The easiest way to do this is to perform a wildcard search for *.MP and *.XML against the root management server, the SQL server, and the installation CD. Then copy all these files to a local directory.

In the Authoring Console, select Tools | Options and select the References tab. Click Add and select the path you copied the MP and XML files to.

Configure the namespace

In the Authoring Console, select Tools | Options and on the General tab enter in your default namespace. This should follow a standard naming scheme used in your company, you can look at how Microsoft names their MPs for examples.

Add in additional references

To perform all the functions needed, the authoring console doesn't reference all the needed MPs.

In the Authoring Console, select File | Properties and click the References tab. There you will see 4 MPs referenced, we need to add 2 more.

Click Add Reference

Browse to your local copy of the MPs

Select System.Performance.Library.mp, click OPEN

Repeat for Microsoft.SystemCenter.InstanceGroup.Library.mp

Click OK

Creating a class

Since we are monitoring an application, we first need to create a class for the application. We want to do this so we can limit our monitoring to only those systems we are interested in, as well as limiting the tasks and other functions.

Click the Service Model tab in the Authoring Console and click Classes in the tree view.

Select New | Windows Local Application

Enter the ID following your naming scheme

Enter a friendly display name, next

Most likely there will be no key properties, so click finish

Creating a discovery

Now that we have our application class, we need to discover the application. The easiest way that I have found to do this is via WMI.

Click the Health Model tab in the Authoring Console and click the Discoveries node

Select New | WMI

Enter various information on the General tab

NOTE: the element ID needs to be different every time it is used. So if you created a class with the ID CompanyX.Application, the discovery ID could be CompanyX.Application.Discovery.

In the Target section, make sure to select the class you previously created

The WMI query can be simple or it can be complex depending on what you are discovering. If you are not 100% sure what you are typing (and who is?) you can use WBEMTEST to confirm everything

WMI Namespace: root\cimv2

Query: Select * from Win32_Service where name= 'servicename'

Frequency: 86400 (once per day)

Alternatively, you can discover multiple services by using different queries

Select * from Win32_Service where name like 'servicename*' (note the * as a wildcard character – this only work in W2k3 and above)

Select * from Win32_Service where name='servicename' or name='servicename2' or name='servicename3'

On the Discovery Mapper page

Select the Class ID you are discovering

Under Key Properties, select Host | Principal Name

Creating groups and populators

Now that we have our class, we need to create a SCOM group for use with the various UI components. The goal here is to create a group of computers that contain the service we are monitoring. This is different than creating a group of the services.This is where it gets a little complicated and some text editing is needed.

Click the Service Model tab of the Authoring Console and select the Classes node

Select New | Computer Group

Enter the group ID and display name (standard warning on naming scheme)

Once the group is created, we need to create the discovery to populate the group

Click the Health Model tab and select the Discoveries node

Select New | Custom Discovery

Create a unique identifier and click OK

Enter a name and for the target select the computer group you just created (NOTE: its icon should be a gray diamond with an underline, not a blue diamond)

On the Discovered Types tab select the bottom Add button (next to Discovered relationships and their attributes)

Select Microsoft.SystemCenter.InstanceGroupContainsEntities

On the Configuration tab, click Browse for a type

Select Group Populator

Under Module ID, I don't know what it expects so I think you can put anything there, click OK

Note: You will likely receive an error, I believe this can be ignored

Back on the Configuration tab, select Edit and replace the Configuration contents with the following

Once the Wizard is completed, we need to perform more editing to configure alerting

Select the monitor you just created and click Properties

On the Configuration tab you can see the service configuration.

NOTE: the CheckStartupType option allows you to specify if you want to monitor only services configured to Auto start or all startup types. If you wish to change this you will have to click Edit… to open the text editor and change this option to true

On the Health tab you select the states for a running or not running service.

The Alerting tab allows you to select if you want to generate alerts or not, and according to what state

The Diagnostic and Recovery tab allows for automatic recovery tasks to take effect

Lastly the Product Knowledge tab allows for custom knowledge to be imported

I followed the steps to create Mp but at step creating "CUSTOM DISCOVERY" after creating Computer group i got belwo error. This after I updated the config file with the code you have given: Can you please help in identifying what i am missing here.************************************Error message at Step "Creating groups and populators"************************************Note: The following information was gathered when the operation was attempted. The information may appear cryptic but provides context for the error. The application will continue to run.

What are the steps to author the MP and setup a Rule/Monitor using the Authoring Console to raise an alert when the application event log writes the event with specific event id?Do I use the rule or monitor in this case?