Menu Close

Using the free Silect MPAuthor to create a class, discover and monitor a service

This post will be a simple walk through on how to create a class for an application, discover instances of that class, and then monitor a service associated with that application:

First – make sure you have the latest version of MP Author from Silect:  https://www.silect.com/mp-author/

Open up MP author, and create a new Management Pack.  If you are prompted about reference packs – choose Yes.

Provide a name for your MP.  In this example – I am going to discover and monitor anyone running the Microsoft iSCSI Initiator service.

image

I create a folder structure for all my custom MP’s in C:\MPDEV:

image

Accept default references and then choose empty management pack:

image

Then Finish.

 

Create the Target Class

 

 

Browse to Targets, right click – and choose New Registry Target:   (hint: A Target is the same thing as a Class)

image

Browse to a machine on your network running the service you seek:

In this case – I am going to browse the HKLM\SYSTEM\CurrentControlSet\Services hives, looking for the iSCSI initiator service, which is MSiSCSI.

Now if I just wanted to discover all the systems that had this registry path – I could.  But that is not really what I am after.  I want all systems that are actually RUNNING the service.  So I will trigger on the registry VALUE of “Start”.

2 = Automatic.  3 = Manual.  4 = Disabled.

I highlight the Registry value I want (Start) and click Add:

image

Click OK and I have this:  I want to discover when the service is set to Automatic (2)

image

Now I need to give my Application a name.  I could accept the defaults here but I like to customize this:

image

Next – we can customize the details for the discover.  I like these so I leave them at their defaults:

image

Next on the Expression – I can ensure that I am checking for a specific content of a registry value, or just look for the existence of a registry key or value.

image

For the frequency – every 1 days is almost always sufficient.  The agents will run this discovery immediately once they receive the MP so you wont need to wait a full day while testing.  Also – agents run these discoveries on every agent startup – so for testing we can bounce the agents if we need it to run again.

image

At this point we can save our work – and test import this into our lab.  Right click the management pack itself, and choose Deploy:

image

Input your SCOM server and your credentials, and MP Author will do the rest.  You will see this when it finishes:

image

 

Now – lets check and see if we are discovering the right instances:   In the SCOM Console > Monitoring > Discovered Inventory.  Change target type to your new class.

image

 

I can see right away that I am discovering instances!

image

 

These are showing as “Not Monitored” and this is by design.  We have not targeted ANY monitors to this class yet, therefore there will be no state to roll up.

Lets go do that now!   Back in MPAuthor, lets increment our MP version:

image

 

Create a Service Monitor

 

Then go to Monitors, right click, and Create New Service Monitor:

image

Browse the same server as before, and find your service in the list.  NOTE***  We need to change the “target” class from the default of Windows Computer, to our custom class we created as seen below:

image

 

Customize the name of the monitor to make good sense:

image

Specify your desired health states:

image

 

Configure and customize alerting:

image

 

Creating Folders and Views

 

While we are here – we should create some folders and views for our MP to round it out:

We need a folder for the MP to show up in the monitoring view:  Always choose Microsoft.SystemCenter.Monitoring.ViewFolder.Root

image

Then customize the name/display/description

image

Once that is complete – create a view:  Lets start with an Alert View:

image

For the folder – choose the folder we just created, and Alert category:

image

Set the target for the view – this will be the scope of the alerts we want to see, so I restrict this to our custom class.

image

Then customize the view ID/DisplayName/Description:

image

 

Now lets create a state view for viewing the health state of our new class:

image

I want an unfiltered view – so I configure it to show me all states of my custom target class:

image

image

 

Save that, and Deploy it!

 

Now I can see my Folder, and my views.  I have health state working:

image

And my alert views and alerts are working:

image

 

 

Summary:

 

As you can see – this is creating management packs the RIGHT way.  We don’t have to target everything to “Windows Computer” and try to work woth overrides and enable for this, disable for that, and make a big mess.  We should create classes for applications and monitor each application/service as an entity.

We created a class, created a monitor, and created the folder and some initial views.  Adding additional monitoring to this just gets easier and easier.

3 Comments

  1. Röger Östnes

    Thanks to you and a great software, I use MP Author for creating my own customized MP’s.

    But, I have never so far been able to deploy a working MP for populating a group with servers residing in a AD Group.
    I have tried your fragment from your repository but always end up with an error message when try to open properties stating: The group can not be modified because there is no group population rule defined for this group.

    Viewing group members and it’s empty.
    Logs are all fine, so SCOM seem to be ok with it. Although it’s not doing what I was hoping.

    I can’t find any help googling it either, is there any chance you can point me in the right direction here?

    Thanks in advance
    Roger

    • Kevin Holman

      My fragment works fine. The UI error is normal…. groups populated with a custom datasource always do this – the UI doesn’t understand them.

      Use the events in the script to troubleshoot why the script isnt pulling back what you expect.

  2. Roger Östnes

    Your fragments works fine, absolutely. It was me not understanding the way they worked.
    Thank for tips, got it now.

    Works like a charm.

Leave a Reply

Your email address will not be published.