For a clearer picture

Tag: SCOM Relationships

Part 6 – Application Server and Groups

Microsoft doesn’t have a management pack for your in-house applications or even most 3rd party applications. So there are no classes, no discoveries, no relationships and no monitoring. That is where we, as SCOM specialists \ Subject Matter Experts, earn our keep. So let’s get going.

First; when I have a problem with my application I want my application team to deal with it. I don’t want the health rolling up to the windows computer object. So when I create the class for my application server I will:

  • Base it on Microsoft.Windows.ApplicationComponent
  • Create a hosting relationship to Windows Computer (as I want the agent on the computer to “host the monitoring”).
  • NOT create a dependency roll up monitor to windows computer – this way I keep my health state at the application layer and not the computer (infrastructure) layer. Note that if I had based my class on Microsoft.Windows.Computer or Microsoft.Windows.LocalApplication that I would not be able to manage the health rollups. A relationship and dependency rollup monitor would exist automatically.
  • Create a Filtered Registry Discovery Provider – I have created a windows service in C# and will use the registry key for that but you can always create your own registry keys which we will do for other components
  • Create a Group of Application Servers
  • Create a Group of Windows Computer Objects that host the Application Servers
  • Create a Group of Operating System Objects that host the Application Servers
  • Create a Group of Logical Disk Objects that host the Application Servers
  • Create a Group of Health Service Watcher Objects for the Application Servers

I will do this as a set of individual Management Pack fragments but you will be able to see that once we have done this; we can actually create a single Management Pack fragment that we can use in the future.

I’ll create a folder structure in Visual Studio. This is very much personal preference and I tend to follow the layout from the SCOM 2007 authoring console of Service Model, Health Model and Presentation folders but for the purpose of this walk through I’ll do the following:

1. Create a class for my application server based on Microsoft.Windows.ApplicationComponent

Right Click ClassesDiscoveriesRelationship and choose Add New Item, Empty Management Pack Fragment and call the fragment 1_Batura_ApplicationServer_Class

Copy and paste the following code:

If you try and build the solution at this stage you will get an error as we have stated in the class definition that the class is hosted but we haven’t defined the hosting relationship yet.

2. Create the Hosting Relationship to Windows Computer

Right Click ClassesDiscoveriesRelationship and choose Add New Item, Empty Management Pack Fragment and call the fragment 2_WindowsComputer_Hosts_BaturaApplicationServer

Copy and paste the following code

Now you can build the solution and it should (it will!) build successfully.

3. Create a Filtered Registry Discovery Provider Discovery

Right Click ClassesDiscoveriesRelationship and choose Add New Item, Empty Management Pack Fragment and call the fragment 3_RegistryDiscovery_BaturaApplicationServer

Copy and paste the following code

You’ll need to change the registry key if you are following this through.

And then deploy the management pack and go to the SCOM console, Monitoring blade and Discovered Inventory. Scope for the Batura Application Server Class

At the moment the class is listed as Not Monitored as we don’t have any monitors targeted at it. I’ll look at creating service monitors in a later article but I’ll do a quick digression here so that we can have a health state and check that our code is working when we come to the groups and health state rollups.

Digression Alert – creating a windows service and service monitor

See here on how to create a windows service and then a windows service monitor.

This shows our Batura Application Server with a health state so that when we create our groups and dependency roll up monitors, we can validate that they work.

4. Create an instance group of Batura Application Servers with a health rollup state.

For this, we will need to reference the Microsoft Instance Library. Right click References in Solution Explorer and choose Add Reference, and browse to c:\program files (x86)\system center visual studio authoring extensions\references\OM2012R2 and choose Microsoft.SystemCenter.InstanceGroup.Library.mp

Then right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 4_Group_BaturaAppServer

Copy and paste this code into the empty fragment and build \ import.

Then scope discovered inventory to the Batura Application Server Group and you should see the following:

5. Create a Computer group of Batura Computers.

This is very different to the group of application servers (or operating system objects). This is a group of computer objects which will have a health state that rolls up from monitors that are targeted at Windows Computer.

Then right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 5_Group_BaturaComputers

Copy and paste this code into the empty fragment and build \ import.

Note in here that we are using “Contains” to get a group of computer objects that contain the Batura Application Server. Because we know that the Batura Application server is directly hosted on the windows computer, we can use the MaxDepth property to tell SCOM to just look at direct child classes.

Then scope discovered inventory to the Batura Computer Group and you should see the following:

Notice that the group has a health state – I’ve included a dependency rollup monitor in the code so that the group will have a health state equal to the worst health state of any members.

6. Create a group of Operating System objects

The performance metrics for logical disk, memory and processor are targeted at Operating System classes so a group of these objects will assist us when we come to do some performance views.

Then right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 6_Group_BaturaOperatingSystem

Copy and paste this code into the empty fragment and build \ import.

One of the challenges you will see here is that the Health Explorer shows the target – which in this case is the Operating System version. We can’t see in Health Explorer the actual server name. We can “fix” that in Squared Up.

7. Create a group of health service watcher objects

Why? Well; lets stop the agent on a healthy server. And you’ll see the computer groups stays green. The server greys out in the console but greyed out isn’t a health state. The health state remains that of the object when it was shut down.

And the way we have designed the monitoring, this means the application also stays green.

But by including the health service watcher object; we can see that something is wrong.

To create the group, right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 7_Group_HSW

Copy and paste this code into the empty fragment and build \ import.

8. Create a group of IIS websites

This is more straight forward once we know that the property we are looking for is Description. To find this out we can either look in the state view of the SCOM console or, a much better way, is to use the Management Pack Browser in Visual Studio. If it isn’t visible then go to the menu bar and choose View, Management Pack Browser. This was we can also find the Management Pack the base class is created in as well as the actual base class itself.

Then right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 8_Group_IISWebsites

Copy and paste this code into the empty fragment and build \ import.

Interestingly, if you look at the health explorer from the above screenshot you will see that you don’t just have your website rolling up health but also your application pool. This is because there is an out of the box dependency rollup monitor provided by Microsoft that rolls up the health of the application to the website.

And you’ll find that if you do stop the application pool, the website will go critical.

For this reason you will find that you might want to take a different approach to modelling your applications. Using groups means that all of the monitors that are targeted at the website will affect the health state of the class and hence the group. If we really want to target specific monitors then we need an alternative approach which will be discussed in another set of blogs.

9. Create a group of IIS Application Pools

To create the group, right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 9_Group_IISApplicationPool

Copy and paste this code into the empty fragment and build \ import.

And you should see this:

10. Create a group of Microsoft SQL Databases

To create the group, right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 10_Group_SQLDatabases

Copy and paste this code into the empty fragment and build \ import.

And you should see this:

11. Create a group of all the groups

And finally; lets create a top level group for our application and have all the other groups as nested members.

To create the group, right click the ClassDiscoveriesRelationship folder in Solution Explorer and choose Add, New Item, Empty Management Pack fragment and name it 11_Group_Application

Copy and paste this code into the empty fragment and build \ import.

And you should see this:

Next step …

… is to put this onto a dashboard.

Previous steps

Part 1 – Series Background

Part 2 – Visualisations with Squared Up

Part 3 – Application Monitoring Overview

Part 4 – Monitoring Overview

Part 5 – Create the Management Pack Solution and Project

Future articles

Part 7 – Create the Squared Up Dashboard