Archive for the ‘SCOM 2007’ Category

Together with my old fellow MVP Bob Cornelissen and friend of him David Scheltens we have recently created community SCOM management pack for measuring MS SQL IOPS.
The MP is finally polished and is posted MS Technet gallery.

Starting SQL 2005 SQL DBA’s have the possibility to use Dynamic Management Views and Functions to monitor the health of a server instance, diagnose problems, and tune performance. This management pack is specifically geared towards the sys.dm_io_virtual_file_stats view, which returns I/O statistics for data and log files. The view is used by DBA’s to view current counter values for each database file (data or log). It is a current point in time and these values are cumulative values since the last restart of the server. This management pack collects these values for use in viewing and reporting. There are no health state changes or alerts connected to these values.
This Management Pack is provided free of charge by the authors to the System Center community.


Writers of this management pack:
Bob Cornelissen. Microsoft MVP System Center Cloud and Datacenter Management, Managing Consultant of BICTT in the Netherlands, Author of the book Mastering System Center 2012 Operations Manager.
David Scheltens. Senior SQL DBA and Owner of Multibyte in the Netherlands.
Pavel Dzemyantsau. Chief IT Engineer at EPAM Systems in Belarus. Contributor to the book Mastering System Center 2012 Operations Manager.


it has been hidden for ages 🙂

we do have a way to set dynamic severity or priority for SCOM 2007/2012 Alert Rule

all we need is to author it as follows:

<WriteAction ID="RuleId.WriteAction" TypeID="Health!System.Health.GenerateAlert">

something about this

$groupDisplayName = 'GROUP_X'
$groupId = Get-MonitoringClass | ?{$_.DisplayName -eq $groupDisplayName} | %{$_.Id}
Get-NotificationSubscription  | %{$notificationName = $_.DisplayName;$_.Configuration| %{ if($_.MonitoringObjectGroupIds -eq $groupId){$notificationName}}}

In series of blog posts i’m going to show advanced technique of web application monitoring scenarios for SCOM.
This technique does not use standard Web Application template and is based on IE Automation.

I start from raw data for now. Later will add more details.

Part1: IE Automation.

Again, for now i’m just posting raw data.


  1. OpenStartPage
  2. Check if elements User, Pass, SignIn are loaded
  3. Fill in User, Pass
  4. Click ‘SignIn’
  5. Check if ‘LiveId’ DOM element is loaded
  6. Get LiveID DOM element value and compare it with provided User
  7. Report scenario time

On each step script tries to report HTTP/Timeout errors and stops script execution.

'Author: Pavel Dzemyantsau
'Note:   Demonstrates POC of IE Automation for LiveID login.


'create automation object
Set oIE = WScript.CreateObject("InternetExplorer.Application","IE_")

Timeout=60 'seconds
oIE.visible=1 : BeginTimer = Timer
oIE.Navigate strURL
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing : Set DOM_Element_2 = Nothing : Set DOM_Element_3 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   On Error Resume Next
      Set DOM_Element_1 = oIE.Document.getElementById("i0116")           'User
      Set DOM_Element_2 = oIE.Document.getElementById("i0118")           'Password
      Set DOM_Element_3 = oIE.Document.getElementById("idSIButton9") 'SignIn button
      If     (Not(DOM_Element_1 is Nothing)) _
         And (Not(DOM_Element_2 is Nothing)) _
         And (Not(DOM_Element_3 is Nothing)) Then
       'all elements we are going to use are loaded
      End If
   On Error Goto 0

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
End If

'Fill in User/Pass
DOM_Element_1.value=strUser 'TODO: loop to check if user has been set
DOM_Element_2.value=strPass 'TODO: loop to check if pass has been set

Timeout=120 'seconds
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   On Error Resume Next
      Set DOM_Element_1   = oIE.Document.getElementById("idWinLiveIdValue") ' LiveId
      If (Not(DOM_Element_1 is Nothing)) Then
       'element we are going to use is loaded, now is checking its attrubute 'title'
        Set DOM_Element_1_attribute_1 = DOM_Element_1.attributes.getNamedItem("title")
           If Not (DOM_Element_1_attribute_1 is Nothing) Then
              'attribute found
              If LCase(DOM_Element_1_attribute_1.value) = LCase(strUser) Then
                'attribute title has correct value
              End If
           End If
      End If
   On Error Goto 0
EndTimer = Timer

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
End If

Wscript.Echo "Scenario time(sec): "& (EndTimer-BeginTimer)

oIE.Stop : WScript.Sleep(5000) : oIE.Quit

Sub IE_NavigateError(ByVal pDisp,ByVal URL,ByVal TargetFrameName,ByVal StatusCode,ByRef Cancel)
    WScript.Echo "StatusCode="&StatusCode
End sub

Just found an issue with SCOM 2007 R2 CU5 when updating from CU4. According to the deployment guide
Microsoft.SystemCenter.Library MP could have been updated to version 6.1.7221.81

But… update process fails to do this when you have CU4 installed.
According to KB this MP is supposed to be updated by CU5_Database.sql.

Looking into the script I easily identified “bottleneck”

DECLARE @ver nvarchar(25)
 DECLARE @compare int
 SET @ver = (SELECT Mpversion FROM ManagementPack WHERE MPName = 'Microsoft.SystemCenter.Library')
 -- Update Microsoft.SystemCenter.Libarary MP directly via SQL
 SET @compare = dbo.fn_VersionCompare (@ver, '6.1.7221.50')
 IF( @compare = -1)
 EXEC [dbo].[p_MPImportXML]
 @ManagementPackXML = N'

with CU4 installed Line 3 of the code sets @ver to ‘6.1.7221.61’.
Function ‘dbo.fn_VersionCompare’ does smart compare of two strings and returns

  • -1 if string1 is less than string2
  • 0 if strings are equal
  • 1  if string1 is greater than string2

with @ver=’6.1.7221.61′  function returns 1, this blocks update procedure to happen.

Once I identified where issue is. Let’s think about next steps.

There are tree options:

  1. download updated MP and import it from SCOM console. This is NOT recommended by Microsoft. There is a negative side affect: you may loose all connectors and will have to restore OpsDB from backup. See KB article for more details:
  2. or correct CU5_Database.sql as follows:
    SET @compare = dbo.fn_VersionCompare (@ver, '6.1.7221.81')

    this is unsupported way. Follow at your own risk. I followed 🙂 and now have .81 MP installed.

  3. do nothing

Being IT geek I couldn’t help continuing and tried to compare two versions of the same MP.

doing this i’m trying to answer a question:

  • was this MP really updated from previous CU or it is just republish with new version number?

We have: CU4 6.1.7221.61 CU5 6.1.7221.81

Loading both versions into notepad++ with compare plugin installed and clicking “Compare”….I see the only ONE difference and this line is MP Version.

so, option three is the right answer to the question: what to do next.

Does SCOM have any built-in monitor for Interop Provider /xPlat agent certificate expiration check?

Interop Provider certificate expired..

It is not a secret that “Interop Core” is pure xPlat agent and “Interop Provider” is just additional xPlat provider.
So I poked around xPlat monitors if we have some for certification expiration check.

As I do remember there is PROACTIVE monitoring for Windows agents certificate expiration for those agents which communicate using certificates. I was really surprised there is no PROACTIVE monitoring for xPlat agents certificate expiration.
All we have is REACTIVE monitor targeted to “Unix Computers” named “WS-Management Certificate is valid”.
Monitor alerts if certificate has already expired (error code 0x80072f8f). Surprise.

One may try to create WebApplication monitor for each InteropCore computer / xPlat agent.
Unbelievable, but it DOES work if you configure it as follows:
SCOM Console>Authoring>Templates>Add WebApplication

then optionally you may configure alerting on Custom unit monitor adding DaysToExpiry into alert body as

To test if monitor works set Value=10000

here is slightly updated SCOM SDK sample showing how to create an override choosing an object as an override target.
How to Create an Override for a Monitor

//creating override for "Agent processor utilization" monitor for first found Health Service object in Error state.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Administration;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;

namespace SDKSamples
    class Program
        static void Main(string[] args)
            ManagementGroup mg;
            ManagementPack mp;
            MonitoringClassCriteria classCriteria;
            MonitoringClass monitoringClass;
            MonitorCriteria monitorCriteria;
            MonitoringObject monitoringObject;
            MonitoringObjectCriteria objectCriteria;
            ManagementPackMonitor monitor;
            ManagementPackMonitorPropertyOverride monitorOverride;

            //connecting to management group
            mg = new ManagementGroup("localhost");
            //getting reference to unsealed management pack
            //code will fail if no MP with 'OverrideTestMP' name is found 
            mp = mg.GetManagementPacks("OverrideTestMP")[0];
            //preparing criteria to get 'HealthService' class C# object
            //Criteria syntax
            classCriteria = new MonitoringClassCriteria("Name='Microsoft.SystemCenter.HealthService'");
            monitoringClass = mg.GetMonitoringClasses(classCriteria)[0];

            objectCriteria = new MonitoringObjectCriteria(string.Format("HealthState='{0}'", (int)HealthState.Error), monitoringClass);
            monitoringObject = mg.GetMonitoringObjects(objectCriteria)[0];

            monitorCriteria = new MonitorCriteria("DisplayName='Agent processor utilization'");
            monitor = mg.GetMonitors(monitorCriteria)[0];

            monitorOverride = new ManagementPackMonitorPropertyOverride(mp, "SampleMonitorOverride");

            monitorOverride.Monitor = monitor;
            monitorOverride.Property = ManagementPackMonitorProperty.Enabled;
            monitorOverride.Value = "false";
            monitorOverride.Context = monitoringClass;
            monitorOverride.ContextInstance = monitoringObject.Id; //Here is key difference between MS example and this one 
            monitorOverride.DisplayName = "SampleMonitorOverride";


            //Save the changes into the management pack.