For a clearer picture

Category: Squared Up

Part 1 – Overview – What next for Global Service Monitor?

Part 1 – Overview – What next for Global Service Monitor?

Microsoft dropped the bombshell a couple of months ago that Global Service Monitor (available as part of System Center Operations Manager) was being deprecated on November 7th. This doesn’t leave customers with much time to make alternative arrangements.

The Microsoft road map is to migrate the Global Service Monitoring functionality to Azure Application Insights although this will present challenges to customers who haven’t gone down the Azure route; something I will look at later in the series.

In this series I’m going to do a series of posts to help customers who can adopt Azure Application Insights to show:

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

Part 5 – Create a Management Pack Solution and Project

Lets get started. I’d definitely recommend using a set of naming standards and I’ll go through mine as we build the management pack.

Fire up Visual Studio and choose to create a new project. The application we will monitor is called Batura – you might notice a theme to the name of my applications which dates back to my love of hill walking and moutaineering and what is, to me, one of the beautiful mountain ranges in the world.

I’ve chosen to use a SCOM 2012 R2 project but if you know that you’ll always be working on SCOM 2016 or later and don’t need the management pack to ever work on earlier versions then you can choose SCOM 2016 here. Both SCOM 2012 R2 and SCOM 2016 use the same management pack schema so the main difference here is the minimum version of the core management packs that your project will require.

You’ll notice that I have named the management pack as follows:

  • Project Name = F12.Batura.Monitoring
  • Solution Name = F12.Batura.Solution

In practice, I would ideally have a library management pack which would include classes, discoveries and relationships, a monitoring management pack for the rules, monitors, tasks, recoveries and diagnostics and a presentation management pack for the views. This can make change management easier as well as it isn’t necessary to have the same level of rigor over a change to a view as it is to a PowerShell script in a monitoring management pack.

Now we need to define our management pack properties – in Visual Studio, go to properties on the menu bar and the project properties will be the last item in the drop down.

One of the items that can frequently be overlooked is setting a management pack display name (this is different from the friendly name that you specify in this window. The display name is the name that will show in the administration blade of the SCOM console (under Management Packs) and to set the display name, click on the hyperlink at the bottom of the above window.

For the description, I like to put a link to the Management Pack documentation. If you use a document management system that injects some characters that “break” the xml then you can use CDATA tags to encapsulate the string as follows:

Using CDATA tags in Description
    
     <Description><![CDATA[http://mydocumentmanagementsystem/mydocument]]></Description>
    
  

Now; we’ll finish off setting our properties.

We’ll need to seal our management pack. If you need to create key file then the process is discussed here – the process is the same for Visual Studio 2015 and 2017 with a change of path for the relevant version.

I have also set an output path rather than using the default. I then make sure that this is included when I save my source code to Team Foundation Server (the same can be done if you are using other solutions such as Git).

You can set a default management group to deploy your management pack and then finally you can set whether you want to increment the version number with each save. If you are working as a team I would deselect this as each version number in Visual Studio is personal to you. So I always manually update the version number separately when I do my final build prior to checking in to Team Foundation Server.

With our Management Pack properties defined, we can now move on to start to create our classes.

Previous articles

Part 1 – Series Background

Part 2 – Visualisations with Squared Up

Part 3 – Application Monitoring Overview

Part 4 – Monitoring Overview

Later articles

Part 6 – Create the Management Pack components

Part 7 – Create the Squared Up Dashboard

Part 4 – Authoring the Management Pack – classes, discoveries and relationships

This is a summary of what we will walk through:

  • Create a Management Pack Solution and Project
  • Create a class for application server based on application component –> so health doesn’t roll up to windows computer. We want our infrastructure teams to support the computer and our application teams to support their applications.
  • Create a relationship that the application component is hosted by windows computer. The monitoring will be done by the agent on the computer (it is hosted by the computer) but without the dependency roll up there will be no health rollup to windows computer
  • Discover the application servers based on a registry key
  • Create Groups
    • Create a group of application servers
    • Create a computer group of application servers
    • Create a group of logical disks from the application servers
    • Create a group of websites
    • Create a group of application pools
    • Create a group of databases
    • Create a group of Health Service Watcher Objects
    • Create a group that contains all the other groups (this will provide us with the health state of the application)
  • We want our groups to have a health state based on the health state of the objects within the group. I have therefore created a dependency rollup monitor for each of the groups.
Previous articles in series

Part 1 – Background

Part 2 – Visualisations with Squared Up

Part 3 – Application Monitoring Overview

Later articles in the series

Part 5 – Create the Management Pack Solution and Project

Part 6 – Create the Management Pack components

Part 7 – Create the Squared Up Dashboard