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

$Data/Context/DataItem/RequestResults/RequestResult[@id=’1′]/BasePageData/DaysToExpiry$
To test if monitor works set Value=10000

Advertisements

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 http://msdn.microsoft.com/en-us/library/bb437603.aspx
            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";

            mp.Verify();

            //Save the changes into the management pack.
            mp.AcceptChanges();
        }
    }
}

just in case you need to add SCOM custom performance data by means of SDK thru powershell. Here it is.

$comp=Get-MonitoringClass -name Microsoft.Windows.Computer | Get-MonitoringObject | ?{$_.DisplayName -match 'YOUR_COMP'}
$counter = new-object -Type Microsoft.EnterpriseManagement.Monitoring.CustomMonitoringPerformanceData("Object","Counter",100)
$comp.InsertCustomMonitoringPerformanceData($counter)

here is an T-SQL to get Management Pack version directly from OperationsManager database

Use OperationsManager
declare @xml xml;
select @xml = (select MPXML from ManagementPack where MPName = 'Microsoft.SystemCenter.Library')

select t.rows.value('data(.)', 'varchar(20)') as Version
from @xml.nodes('//ManagementPack/Manifest/Identity/Version') as t(rows)

just in case you need to grab all active SCOM alerts related only to single windows computer and all hosted objects(e.g. IIS server, SQL server, etc) directly from OperationsManager DB.
Use this script

DECLARE @LanguageCode1 VARCHAR(3) 
DECLARE @ManagedEntityId NVARCHAR(MAX) 
DECLARE @LastModified DATETIME 
DECLARE @ResolutionState0 NVARCHAR(MAX) 

SET @LanguageCode1='ENU' 
--GRAB ID FROM SECOND SCRIPT
SET @ManagedEntityId=N'74be7cbd-2c72-8d5e-2f48-49583ae4dd30' 
SET @LastModified=Getutcdate() - 7 
SET @ResolutionState0=N'0' 

SELECT * 
FROM   dbo.Fn_alertviewchanges(@LanguageCode1, NULL, @LastModified, 
       @LastModified, 
              @LastModified) AS alertview 
       LEFT OUTER JOIN dbo.mt_computer 
         ON alertview.toplevelhostentityid = mt_computer.basemanagedentityid 
WHERE  (( alertview.[ResolutionState] = @ResolutionState0 )) 
       AND ((( alertview.[MonitoringObjectId] IN (SELECT f.[BaseManagedEntityId] 
                                                  FROM 
                       dbo.Fn_containedbaseentitiesfromlist(@ManagedEntityId, 0) 
                       AS f) 
             )))

where BaseManagedEntitiId is one of the lines from output of this script:

SELECT * FROM [OperationsManager].[dbo].[BaseManagedEntity]

inspired by this community post: Powershell Subscribers Names – Devices / Name – address

in case you need to enumerate all SCOM 2007  R2 subscriptions and in the same time for each subscription expand Device Names and Addresses, use the following script:

Get-NotificationSubscription |%{$c=$_.ToRecipients; $b=@($c|%{$_.Name}); $d=@($c|%{$_.Devices}|%{$_.address});"'{0}' '{1}' '{2}'" -f $_.DisplayName,[string]::join(':',$b),[string]::join(':',$d) }

output will be as follows:

'Subscription'    'colon-delimeted-Subscribers'      'colon-delimeted-Addresses'

as response to this community post i’ve investigated a bit heart of Web console and found the following useful shortcuts
HOW TO: URL links to individual systems

StateView for single object
http://web_console_url:51908/default.aspx?DisplayMode=Pivot&ViewType=StateView&PmoId=objectId

HeathExplorer for single object
http://web_console_url:51908/ResultViews/ViewTypeHealthExplorer.aspx?targetId=objectId

Diagram view, direct link
http://web_console_url:51908/default.aspx?DisplayMode=Pivot&ViewType=DiagramView&PmoID=PmoId

To get objectId use this PoSh snippet

Get-MonitoringClass | ?{$_.Name -match 'Microsoft.(Unix|Windows).Computer$'} | Get-MonitoringObject | select Id,Name, DisplayName

To get PmoId use this PoSH snippet

get-managementpack | %{$MP=$_.DisplayName;$_.GetViews()|?{$_.DisplayName -match '****VIEW_NAME****'}} | select @{name='Id';expression={$_.id}},@{Name='DisplayName';expression={$_.DisplayName}},@{Name='MP';expression={$MP}}