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

<RuleId>$MPElement$</RuleId>

<GroupInstanceId>$Target/Id$</GroupInstanceId>

<MembershipRules>

<MembershipRule>

<MonitoringClass>$MPElement[Name="Windows!Microsoft.Windows.Computer"]$</MonitoringClass>

<RelationshipClass>$MPElement[Name="SC!Microsoft.SystemCenter.ComputerGroupContainsComputer"]$</RelationshipClass>

<Expression>

<Contains>

<MonitoringClass>$MPElement[Name="CompanyX.Application"]$</MonitoringClass>

</Contains>

</Expression>

</MembershipRule>

</MembershipRules>

  • Replace "CompanyX.Application" with the correct value for your application
    • NOTE: If this section here is about the only place that can throw errors here. Make sure the MonitoringClass attribute is correct
  • Back in the Configuration tab, click OK

Creating UI components

Now that we have a computer group, we can create views based on that group and the health of the services in it.

Click the Presentation tab in the Authoring Console and select the Views node

  • Click New | Folder
  • Enter in an appropriate ID and click OK
  • Enter a name, click OK

Now we have a folder to place objects in, we can now create a state view

  • Click New | State View
  • Fill out the general tab, selecting the computer group previously created as the target
  • Click OK and once the wizard is finished, open the object again
  • On the Folder tab, uncheck Monitoring and check the subfolder you previously created
    • NOTE: This is to stop the view from appearing at the root of the management console and be more organized

Creating Monitors

Lastly we need to create a monitor. To be simple, we will only monitor a service state:

Click the Health Model tab in the Authoring Console and select the Monitors node

Select New | Windows services | Basic Service Monitor

Fill out the general information screen

  • Again, note that the Element ID must be something unique. One example could be CompanyX.Application.ServiceY
  • Target is the target class you initially created
  • Parent Monitor should select Availability (or otherwise appropriate category)
  • On the Service Name page, enter the name of the service, click finish

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

6 comments:

Daniel said...

Hi
Thanks for your great Guide. Maybe you can give advice how to populate some groups with a discovered registry key?

Ive tried to rebuild such a group populator like one which was generated with the GUI console but failed to read the discovered attribute.

Greetings
Daniel

Dimitri said...

I've been looking everywhere for this, thanks

pintoo said...

Hi,
Thanks for the guide its very help for new babies in SCOM like me.

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.

: Verification failed with [1] errors:
-------------------------------------------------------
Error 1:
: Failed to verify Discovery [DFG21.monitoring.services.AttribDiscovery]
Failed to verify referenced module : ID=attribdiscoveryInvalid configuration specified for Module [attribdiscovery]Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
-------------------------------------------------------

Failed to verify Discovery [DFG21.monitoring.services.AttribDiscovery]Failed to verify referenced module : ID=attribdiscoveryInvalid configuration specified for Module [attribdiscovery]Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
: Failed to verify Discovery [DFG21.monitoring.services.AttribDiscovery]
Failed to verify referenced module : ID=attribdiscoveryInvalid configuration specified for Module [attribdiscovery]Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
: Failed to verify referenced module : ID=attribdiscovery
Invalid configuration specified for Module [attribdiscovery]Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
: Invalid configuration specified for Module [attribdiscovery]
Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
: Cannot find MPElement: DFG21.Monitoring.Services specified in expression: $MPElement[Name="DFG21.Monitoring.Services"]$
Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]
: Cannot find ManagementPackElement [Type=ManagementPackElement, ID=DFG21.Monitoring.Services] in ManagementPack [ManagementPack:[Name=DFG.Monitoring, KeyToken=, Version=1.0.0.0]]

************************************

Thnaks
Ravi

Anonymous said...

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?

Anonymous said...

wow... This is just amazing... Simply amazing. I wish this was easier to find via google ;)

D Entertainment said...

nào sẽ dựa vào chính bản thân con. Con bây giờ la hoàng trúc ngũ giai đấu khí tu vi, tu luyện trúc tông vũ kĩ tốc độ tăng lên 2 lần, nhất định sẽ có hiệu quả.

Diệp Âm Trúc gật đầu tđồng tâm
game mu
cho thuê nhà trọ
cho thuê phòng trọ
nhac san cuc manh
số điện thoại tư vấn pháp luật miễn phí
văn phòng luật
tổng đài tư vấn pháp luật
dịch vụ thành lập công ty
http://we-cooking.com/
chém gió
trung tâm tiếng anhĩnh tâm nghe dạy bảo.Trúc tông tuyệt học tuyệt đối không thể lưu bằng sách được để tránh tiết lộ ra ngoài, Diệp Trọng nói:
-Trúc tông kiếm thuật và y đạo nổi tiếng. Mai lan cúc trúc tứ tông vũ khí sở dụng vẫn là kiếm, trúc tông kiếm pháp thiên về lực lượng và tốc độ. Động thì như sấm đánh, kiếm pháp căn cứ vào đấu khí lãnh ngộ cao thấp mà quyết định cường nhược. Con từng học qua trúc công, trúc ngự và trúc tinh hàn, đều là trúc tông kiếm pháp tinh diệu và chiêu thức đơn giản. Lúc ấy thời gian không nhiều, ông nội chỉ truyền cho con 3 chiêu này thôi. Con đã có 3 chiêu này làm trụ cột, sau này tu luyện sẽ cũng dễ dàng hơn.

Nói đến đây, Diệp Trọng truyền âm tiếp tục nói:
-Chúng ta trúc tông kiếm pháp, tên là Ngạo Trúc kiếm pháp tổng cộng 36 thức. Mỗi 1 kiếm đều có thật