SCOM Connector Quickstart Guide v1

advertisement
SCOM CONNECTOR QUICKSTART GUIDE
A STARTER’S GUIDE TO DEVELOPING PRODUCT CONNECTORS
Ambrose Wong
Microsoft Corporation
December 07
TABLE OF CONTENTS
Overview ......................................................................................................................................... 1
Sample Outbound Connector ......................................................................................................... 2
Development Platform ............................................................................................................... 3
Step-By-Step Instructions ........................................................................................................... 4
Create an Outbound Connector ............................................................................................. 5
Create An Application To Query and Close Alerts .................................................................. 8
Install the Outbound Connector ........................................................................................... 10
Simulate an Alert Scenario .................................................................................................... 16
Appendix A: About Knowledge Articles ........................................................................................ 22
Adding Your Own Company Knowledge Article ....................................................................... 24
Appendix B: Operations Manager 2007 Command Shell ............................................................. 27
Getting Details from an Alert .................................................................................................... 28
Query For Alert Properties ........................................................................................................ 30
Query for Monitor................................................................................................................. 31
Query for Monitoring Rule.................................................................................................... 32
Query for Management Pack ................................................................................................ 34
References .................................................................................................................................... 36
Blogs .......................................................................................................................................... 36
Newsgroups .............................................................................................................................. 36
OVERVIEW
A connector is a custom service or program that allows System Center Operations Manager
2007 (SCOM) to communicate with external systems. For example, you can create a connector
that sends Operations Manager alerts to an application that tracks the alerts. The application
can use the connector to send an update to Operations Manager, indicating that the alert has
been resolved.
You can develop a custom connector by using the Operations Manager Connector Framework
(OMCF). The OMCF provides methods and types that you can use to initialize and manage a
connector.
The following illustration shows the architecture of the SDK, and where OMCF positions.
As a quickstart guide, this document focuses on developing a sample outbound connector.
You can easily use the same techniques to develop other types of SDK client applications.
Page 1
SAMPLE OUTBOUND CONNECTOR
In the diagram below, an outbound connector can send Operations Manager alerts to external
systems for alert tracking. Alerts closed by external systems can update Operations Manager
to reflect the change of alert state.
Page 2
DEVELOPMENT PLATFORM
The samples in this document are developed and tested on the following platforms:
1. Windows Server 2003 Enterprise Edition 32-bit (x86) with SP2, Active Directory and
Internet Information Services 6.0 enabled
2. System Center Operations Manager 2007
3. Microsoft Windows Server 2000/2003 Internet Information Services Management Pack
4. Visual Studio 2005 Team Suite with SP1
5. SQL Server 2005 Enterprise Edition with SP2
6. Windows Powershell 1.0
Page 3
STEP-BY-STEP INSTRUCTIONS
This section contains step-by-step instructions to produce a simulated outbound connector
scenario where an outbound connector subscribes to and receives alerts. An accompanying
application is used to close the alerts.
Note that the samples are implemented as simplified C# console applications. In real settings
the connector is usually implemented as a service with more sophisticated error handling and
event logging.
Also note the following:
1. The connector’s alert subscriptions can be administered through Operations Manager
console to specify subscription groups, targets, and criteria. They can also be administered
programmatically through Operations Manager SDK for more granular control.
2. Operations Manager polls for alerts every 30 seconds. The connector’s alert subscriptions
are used to mark the alerts for forwarding.
3. The connector polls for alerts at a set interval (30 seconds in the sample). Once alerts are
retrieved from a poll, the connector can further forward them to external systems for
processing. Each alert has a unique AlertId identifier.
4. The connector can optionally set application specific TicketId and CustomField# values for
the alert.
Page 4
CREATE AN OUTBOUND CONNECTOR
Base on the sample from How to Create Outbound Connectors, create a C# console application
called TestConn with the code below, with reference to the following assemblies under
C:\Program Files\System Center Operations Manager 2007\SDK Binaries:
Microsoft.EnterpriseManagement.OperationsManager.dll
Microsoft.EnterpriseManagement.OperationsManager.Common.dll
using
using
using
using
using
using
System;
Microsoft.EnterpriseManagement;
Microsoft.EnterpriseManagement.ConnectorFramework;
Microsoft.EnterpriseManagement.Common;
System.Collections.ObjectModel;
System.Threading;
namespace OutboundConnector
{
class Program
{
static void Main(string[] args)
{
ManagementGroup mg = new ManagementGroup("localhost");
ConnectorFrameworkAdministration cfAdmin =
mg.GetConnectorFrameworkAdministration();
Guid connectorGuid = new Guid("{6A1F8C0E-B8F1-4147-8C9B-5A2F98F10003}"); // Or
create/use your own Guid.
MonitoringConnector connector;
try
{
if (args.Length == 1)
{
if (args[0] == "InstallConnector")
{
ConnectorInfo info = new ConnectorInfo();
info.Description = "Sample connector";
info.DisplayName = "Sample connector";
info.Name = "Sample connector";
connector = cfAdmin.Setup(info, connectorGuid);
connector.Initialize();
Console.WriteLine("Created {0} with ID: {1}", connector.Name,
connector.Id);
}
else if (args[0] == "UninstallConnector")
{
connector = cfAdmin.GetMonitoringConnector(connectorGuid);
ReadOnlyCollection<MonitoringConnectorSubscription> subscriptions;
subscriptions = cfAdmin.GetConnectorSubscriptions();
Page 5
foreach (MonitoringConnectorSubscription subscription in
subscriptions)
{
if (subscription.MonitoringConnectorId == connectorGuid)
{
cfAdmin.DeleteConnectorSubscription(subscription);
}
}
connector.Uninitialize();
cfAdmin.Cleanup(connector);
Console.WriteLine("Connector removed.");
}
return;
}
connector = cfAdmin.GetMonitoringConnector(connectorGuid);
while (true)
{
ReadOnlyCollection<ConnectorMonitoringAlert> alerts;
alerts = connector.GetMonitoringAlerts();
if (alerts.Count > 0)
{
connector.AcknowledgeMonitoringAlerts(alerts);
}
int i = 1;
foreach (ConnectorMonitoringAlert alert in alerts)
{
// Here you can send the alert to the other management system.
Console.WriteLine("#{0} Alert received on {1}", i.ToString(),
DateTime.Now);
Console.WriteLine(">> Id: {0}", alert.Id.ToString());
Console.WriteLine(">> Category: {0}", alert.Category.ToString());
Console.WriteLine(">> ConnectorId: {0}",
alert.ConnectorId.ToString());
Console.WriteLine(">> ConnectorStatus: {0}",
alert.ConnectorStatus.ToString());
Console.WriteLine(">> RepeatCount: {0}",
alert.RepeatCount.ToString());
Console.WriteLine(">> ResolutionState: {0}",
alert.ResolutionState.ToString());
if (!string.IsNullOrEmpty(alert.ResolvedBy))
{
Console.WriteLine(">> ResolvedBy: {0}",
alert.ResolvedBy.ToString());
}
Console.WriteLine(">> LastModified: {0}",
alert.LastModified.ToString());
Console.WriteLine(">> LastModifiedByNonConnector: {0}",
alert.LastModifiedByNonConnector.ToString());
Console.WriteLine(">> Priority: {0}", alert.Priority.ToString());
Console.WriteLine(">> Severity: {0}", alert.Severity.ToString());
Page 6
Console.WriteLine(">> Description: {0}", alert.Description);
Console.WriteLine("");
i = i + 1;
}
//Wait for 30 sec before checking for new alerts again.
Console.WriteLine("Sleeping for 30 seconds...");
Thread.Sleep(30 * 1000);
}
}
catch (MonitoringException error)
{
Console.WriteLine(error.Message);
}
}
}
}
Note that for the following ManagementGroup constructor in the above code:
ManagementGroup mg = new ManagementGroup("localhost");
In actual connector development you should consider which cache mode that best fit your
needs. The cache mode you want to use can be specified using the
ManagementGroupConnectionSettings object for the constructor.
Page 7
CREATE AN APPLICATION TO QUERY AND CLOSE ALERTS
Create a C# console application called Alerts with the code below, with reference to the
following assemblies under C:\Program Files\System Center Operations Manager 2007\SDK
Binaries:
Microsoft.EnterpriseManagement.OperationsManager.dll
Microsoft.EnterpriseManagement.OperationsManager.Common.dll
using
using
using
using
System;
Microsoft.EnterpriseManagement;
Microsoft.EnterpriseManagement.ConnectorFramework;
Microsoft.EnterpriseManagement.Monitoring;
namespace Alerts
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine("Usage: alerts [get|set] [alertid]");
return;
}
string op = args[0].ToLower();
if ((op != "get") && (op != "set"))
{
Console.WriteLine("First parameter needs to be either 'get' or 'set'.");
return;
}
if (args[1].Length != 36)
{
Console.WriteLine("Second parameter needs to be an alert id guid in the
format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.");
return;
}
try
{
ManagementGroup mg = new ManagementGroup("localhost");
ConnectorFrameworkAdministration cfAdmin =
mg.GetConnectorFrameworkAdministration();
MonitoringAlert alert = mg.GetMonitoringAlert(new Guid(args[1]));
ManagementPack mp;
if (alert.IsMonitorAlert)
{
mp = mg.GetMonitor(alert.ProblemId).GetManagementPack();
}
Page 8
else
{
mp = mg.GetMonitoringRule(alert.MonitoringRuleId).GetManagementPack();
}
Console.WriteLine(">> Management Pack Id: {0}", mp.Id.ToString());
Console.WriteLine(">> Id: {0}", alert.Id.ToString());
Console.WriteLine(">> Category: {0}", alert.Category.ToString());
Console.WriteLine(">> ConnectorId: {0}", alert.ConnectorId.ToString());
Console.WriteLine(">> ConnectorStatus: {0}",
alert.ConnectorStatus.ToString());
Console.WriteLine(">> RepeatCount: {0}", alert.RepeatCount.ToString());
Console.WriteLine(">> ResolutionState: {0}",
alert.ResolutionState.ToString());
if (!string.IsNullOrEmpty(alert.ResolvedBy))
{
Console.WriteLine(">> ResolvedBy: {0}", alert.ResolvedBy.ToString());
}
Console.WriteLine(">> LastModified: {0}", alert.LastModified.ToString());
Console.WriteLine(">> LastModifiedByNonConnector: {0}",
alert.LastModifiedByNonConnector.ToString());
Console.WriteLine(">> Priority: {0}", alert.Priority.ToString());
Console.WriteLine(">> Severity: {0}", alert.Severity.ToString());
Console.WriteLine(">> Description: {0}", alert.Description);
if (op == "set")
{
Console.WriteLine("Setting ResolutionState to 255.");
alert.ResolutionState = 255;
alert.Update("Alert closed.");
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
Page 9
INSTALL THE OUTBOUND CONNECTOR
Run the following at the cmd prompt to install the outbound connector.
TestConn InstallConnector
In Operations Console, you should see the connector installed as "Sample connector".
Page
10
Right-click on Sample connector and select Properties. You should see the Properties dialog box
as shown below.
Click the "Add…" button to add a subscription for the connector.
Page
11
In the General tab, put "Test" for both Subscription Name and Description.
Page
12
In the Groups tab, select all groups.
Page
13
In the Targets tab, select "Forward alerts from targets are automatically, including targets in
Management Packs imported in the future."
Page
14
In the Criteria tab, select the following:




Error for Alerts of any of checked severity
High, Medium, and Low for Priority
New for Resolution State
All items in Category
Click the Update button to save the changes. You should now see Test listed in the
Subscriptions list.
Run the following at the cmd prompt to start polling for alerts every 30 seconds.
TestConn
Leave TestConn running and the cmd prompt window open.
Page
15
SIMULATE AN ALERT SCENARIO
Go to Internet Information Services (IIS) Manager from Administrative Tools, and stop the
Default Web Site.
In Operations Console, go to Monitoring tab and select Active Alerts. After a short period you
should see the alert about the stopped default web site.
Page
16
At the cmd prompt where TestConn is running, you should see the same alert as received by
the connector:
#1 Alert received on 12/14/2007 1:46:55 PM
>> Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: Pending
>> RepeatCount: 0
>> ResolutionState: 0
>> LastModified: 12/14/2007 5:46:19 AM
>> LastModifiedByNonConnector: 12/14/2007 5:46:19 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
In the OperationsManager database you can see the alert in the Alert table:
Page
17
Note the AlertId and run the following command at the cmd prompt (substitute the alert id
with the one in your environment).
alerts get 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
You should see an output similar to the following:
>> Management Pack Id: 7a920be5-d53c-fa2d-07a8-b415265e95b0
>> Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: SuccessfullyForwarded
>> RepeatCount: 0
>> ResolutionState: 0
>> LastModified: 12/14/2007 5:46:19 AM
>> LastModifiedByNonConnector: 12/14/2007 5:46:19 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
Note that ConnectorStatus is SuccessfullyForwarded. ResolutionState is 0 (New).
Now run the following command at the cmd prompt to close the alert.
Page
18
alerts set 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
Run the following command at the cmd prompt to check the status again.
alerts get 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
You should see an output similar to the following from the "get" operation:
>> Management Pack Id: 7a920be5-d53c-fa2d-07a8-b415265e95b0
>> Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: Pending
>> RepeatCount: 0
>> ResolutionState: 255
>> ResolvedBy: TESTDOMAIN\Administrator
>> LastModified: 12/14/2007 6:01:13 AM
>> LastModifiedByNonConnector: 12/14/2007 6:01:13 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
Note that ConnectorStatus is now Pending, with ResolutionState set to 255 (Closed) and
ResolvedBy set to the credential that was used to connect to Operations Manager.
In the cmd prompt where TestConn is running, you should also see an output similar to the
following notifying that the alert is closed:
#1 Alert received on 12/14/2007 2:02:02 PM
>> Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: Pending
>> RepeatCount: 0
>> ResolutionState: 255
>> ResolvedBy: TESTDOMAIN\Administrator
>> LastModified: 12/14/2007 6:01:13 AM
>> LastModifiedByNonConnector: 12/14/2007 6:01:13 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
Since the alert is closed, you should see the alert disappear from Operations Console’s Active
Alerts list.
Run Alerts with "get" operation again, and you should see an output similar to the following:
>>
>>
>>
>>
Management Pack Id: 7a920be5-d53c-fa2d-07a8-b415265e95b0
Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
Category: PerformanceHealth
ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
Page
19
>> ConnectorStatus: SuccessfullyForwarded
>> RepeatCount: 0
>> ResolutionState: 255
>> ResolvedBy: TESTDOMAIN\Administrator
>> LastModified: 12/14/2007 6:01:13 AM
>> LastModifiedByNonConnector: 12/14/2007 6:01:13 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
Note that the ConnectorStatus is now set to SuccessfullyForwarded, meaning the connector has
successfully processed the notification.
The test scenario is now complete.
Page
20
Page
21
APPENDIX A: ABOUT KNOWLEDGE ARTICLES
A product knowledge article is a knowledge article that resides in a sealed management pack. A
company knowledge article resides in an unsealed management pack.
Knowledge articles are tied to monitors or monitoring rules. Below is a sample code fragment
that demonstrates how you can get all knowledge articles that tie to an alert’s monitor. For
monitoring rules, use alert.MonitoringRuleId instead of alert.ProblemId.
ReadOnlyCollection<MonitoringKnowledgeArticle> kbs =
mg.GetMonitoringKnowledgeArticles(alert.ProblemId);
foreach (MonitoringKnowledgeArticle kb in kbs)
{
Console.WriteLine("KB ID: {0}", kb.Id.ToString());
Console.WriteLine("KB ElementReference: {0}", kb.ElementReference.ToString());
Console.WriteLine("KB LanguageCode: {0}", kb.LanguageCode.ToString());
Console.WriteLine("KB Status: {0}", kb.Status.ToString());
Console.WriteLine("KB Visible: {0}", kb.Visible.ToString());
if (!string.IsNullOrEmpty(kb.MamlContent))
Console.WriteLine("KB MAML: {0}", kb.MamlContent.ToString());
if (!string.IsNullOrEmpty(kb.HtmlContent))
Console.WriteLine("KB HTML: {0}", kb.HtmlContent.ToString());
Console.WriteLine("MP ID: {0}", kb.GetManagementPack().Id.ToString());
Console.WriteLine("MP FriendlyName: {0}",
kb.GetManagementPack().FriendlyName.ToString());
Console.WriteLine("MP DisplayName: {0}",
kb.GetManagementPack().DisplayName.ToString());
Console.WriteLine("MP Name: {0}", kb.GetManagementPack().Name.ToString());
}
The output from the above code fragment shows the product knowledge article for the Default
Web Site stopped alert from the sample outbound connector scenario.
KB ID: 6c4a6080-3fe1-1e9f-717c-15fb118c92d3
KB ElementReference: ManagementPackElementUniqueIdentifier=ce89d4d4-8264-8c51-5c
d9-a1ff0e314cdd
KB LanguageCode: ENU
KB Status: Unchanged
KB Visible: True
KB MAML: <maml:section xmlns:maml="http://schemas.microsoft.com/maml/2004/10"><m
aml:title>Summary</maml:title><maml:para>This monitor checks the status of the I
IS Web sites. If you receive an alert from this monitor, action is required in o
rder to bring the Web site back to an operational state.</maml:para><maml:para /
><maml:para>Operational States:</maml:para><maml:para>An IIS Web site can be eit
her in a "Running" or "Not Running" operational state.</maml:para><maml:para /><
/maml:section><maml:section xmlns:maml="http://schemas.microsoft.com/maml/2004/1
0"><maml:title>Causes</maml:title><maml:para>An IIS Web site can stop for many r
easons, including:</maml:para><maml:list><maml:listItem><maml:para>The Web site
was stopped by an administrator</maml:para></maml:listItem><maml:listItem><maml:
para>The Web site was stopped by IIS due to one or more errors that occured duri
ng run time.</maml:para></maml:listItem><maml:listItem><maml:para>The Web site w
as improperly configured which caused it to fail or prevented it from starting.<
/maml:para><maml:para /></maml:listItem></maml:list></maml:section><maml:section
xmlns:maml="http://schemas.microsoft.com/maml/2004/10"><maml:title>Resolutions<
/maml:title><maml:para>If an IIS Web site is "Not Running" you can diagnose the
Page
22
issue or restart the site by taking the following actions:</maml:para><maml:list
><maml:listItem><maml:para>Check for additional Web site related alerts that mig
ht have occurred concurrently. These alerts might help better identify the reaso
n why the service entered a "Not Running" state.</maml:para></maml:listItem><mam
l:listItem><maml:para>Review the event logs on the managed computer, and correct
any underlying problems that might have caused the web site to stop unexpectedl
y.</maml:para></maml:listItem><maml:listItem><maml:para>Use the following Task t
o attempt to restart the Web Site.</maml:para><maml:para><maml:navigationLink><m
aml:linkText>Start IIS Web Site</maml:linkText><maml:uri condition="Task" href="
Microsoft.Windows.InternetInformationServices.2003.WebSite.StartWebSite.Task&amp
;tasktarget={$TARGET$}" uri="MOM.Console.Exe" /></maml:navigationLink></maml:par
a></maml:listItem></maml:list><maml:para /></maml:section><maml:section xmlns:ma
ml="http://schemas.microsoft.com/maml/2004/10"><maml:title>Configuration</maml:t
itle><maml:para>This monitor doesn't include any configuration settings that can
be modified.</maml:para><maml:para /></maml:section>
MP ID: 7a920be5-d53c-fa2d-07a8-b415265e95b0
MP FriendlyName: Windows Internet Information Services 2003
MP DisplayName: Windows Server Internet Information Services 2003
MP Name: Microsoft.Windows.InternetInformationServices.2003
Note that the GUID for the knowledge article’s ElementReference is the monitor or monitoring
rule ID, which helps tie them together.
Page
23
ADDING YOUR OWN COMPANY KNOWLEDGE ARTICLE
For many organizations, having company knowledge to accompany the monitor’s or monitoring
rule’s alert is desirable to achieve operational excellence with System Center Operations
Manager.
Company Knowledge article can be added through Operations Console:
As external system tracks alerts from Operations Manager, corresponding company-specific
knowledge information about the monitor’s or monitoring rule’s alerts can be added.
Note:
You cannot modify knowledge articles that reside in sealed management pack. To add your
company knowledge article, you need to save it in an unsealed management pack. Although
there is a default management pack available, best practices dictate that you do not use the
Page
24
default management pack to store information such as company knowledge articles and
overrides. You should create your own management packs to store such information.
To create a management pack, you can use Operations Console, go to Administration tab, rightclick on Management Packs, and select Create Management Pack.
Once you created your unsealed management pack, you can use get-managementpack cmdlet
to get the management pack’s ID. Below is a sample get-managementpack output for a
management pack called Test Management Pack (refer to "Operations Manager 2007
Command Shell" for additional information on cmdlets).
>get-managementpack -name "Test.Management.Pack"
Name
TimeCreated
LastModified
KeyToken
Version
Id
VersionId
References
:
:
:
:
:
:
:
:
Test.Management.Pack
1/4/2008 4:47:54 PM
1/4/2008 4:47:54 PM
1.0.0.0
9ec718e3-f75b-bbb6-9707-e09d42569587
f9d0700b-f34c-40ff-96dc-f890e69ddfa8
{Microsoft.SystemCenter.Library}
Page
25
Sealed
ContentReadable
FriendlyName
DisplayName
Description
DefaultLanguageCode
LockObject
:
:
:
:
:
:
:
False
True
Test Management Pack
Test Management Pack
Test Management Pack
ENU
System.Object
Note the management pack ID.
Below is a sample code fragment that demonstrates how you can add your own company
knowledge article to the Test Management Pack in response to an alert.
ManagementPackMonitor mon = mg.GetMonitor(alert.ProblemId);
ManagementPack mp = mg.GetManagementPack(new Guid("9ec718e3-f75b-bbb6-9707-e09d42569587"));
ManagementPackKnowledgeArticle newkb = new ManagementPackKnowledgeArticle(mon, "ENU", mp);
newkb.MamlContent = "<maml:section
xmlns:maml=\"http://schemas.microsoft.com/maml/2004/10\"><maml:title>Summary</maml:title><m
aml:para>Sample Summary</maml:para></maml:section>";
mp.AcceptChanges();
The code fragment above stores MAML formatted knowledge article in MamlContent property.
You can elect to store HTML formatted knowledge article in HtmlContent property:
newkb.HtmlContent = "<html><B>Summary</B><P>Sample Summary</P></html>";
However, note that you cannot edit the company knowledge article through Operations
Console if your content is stored in HtmlContent property.
Page
26
APPENDIX B: OPERATIONS MANAGER 2007 COMMAND SHELL
Throughout the test scenario described in this document, you can use Operations Manager
2007 cmdlets in the command shell to get additional information about various objects,
including alerts, monitors, targets, management packs, etc.
You can start Operations Manager 2007 Command Shell by going to Start...All
Programs…System Center Operations Manager 2007…Command Shell. The command shell
script is Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1 in the
installation folder.
Below is an Operations Manager 2007 Command Shell prompt.
Page
27
GETTING DETAILS FROM AN ALERT
You can get alert details by using get-alert cmdlet and the alert id from the connector.
For the following output from the sample connector:
#1 Alert received on 12/27/2007 7:04:55 AM
>> Id: 11f18e2a-1aa0-4adc-a2f8-69d216ac1e60
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: Pending
>> RepeatCount: 0
>> ResolutionState: 0
>> LastModified: 12/27/2007 7:05:16 AM
>> LastModifiedByNonConnector: 12/27/2007 7:05:16 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
Note the Id value, and use get-alert cmdlet to get detailed information regarding the alert:
>get-alert -id 11f18e2a-1aa0-4adc-a2f8-69d216ac1e60
Id
Name
Description
MonitoringObjectId
MonitoringClassId
MonitoringObjectDisplayName
MonitoringObjectName
MonitoringObjectPath
MonitoringObjectFullName
IsMonitorAlert
ProblemId
MonitoringRuleId
ResolutionState
Priority
Severity
Category
Owner
ResolvedBy
TimeRaised
TimeAdded
LastModified
LastModifiedBy
TimeResolved
TimeResolutionStateLastModified
CustomField1
CustomField2
: 11f18e2a-1aa0-4adc-a2f8-69d216ac1e60
: Microsoft Windows Internet Information Servic
es 2003 Web Site is Unavailable.
: The Internet Information Services Web Site na
med W3SVC/1 is unavailable as the site has be
en stopped.
: 6aaa027f-2915-8021-e2bf-3ff0b5eec611
: 648f8c95-dd28-84dd-dc64-eb08ee364d32
: Default Web Site
: W3SVC/1
: vpc-w03.testdomain.com
: Microsoft.Windows.InternetInformationServices
.2003.WebSite:vpc-w03.testdomain.com;W3SVC/1
: True
: ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd
: ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd
: 0
: Low
: Error
: PerformanceHealth
:
:
: 12/27/2007 7:04:55 AM
: 12/27/2007 7:04:56 AM
: 12/27/2007 7:05:16 AM
: Connector Framework Alert Write Action
:
: 12/27/2007 7:04:55 AM
:
:
Page
28
CustomField3
CustomField4
CustomField5
CustomField6
CustomField7
CustomField8
CustomField9
CustomField10
TicketId
Context
:
:
:
:
:
:
:
:
:
: <DataItem type="System.PropertyBagData" time=
"2007-12-27T15:04:55.9448448+08:00" sourceHea
lthServiceId="895BD899-3400-4077-5858-55B9DFA
805F8"><Property Name="W3SVC/1" VariantType="
19">4</Property></DataItem>
ConnectorId
: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
LastModifiedByNonConnector
: 12/27/2007 7:05:16 AM
MonitoringObjectInMaintenanceMode : False
MonitoringObjectHealthState
: Error
ConnectorStatus
: SuccessfullyForwarded
RepeatCount
: 0
NetbiosComputerName
: VPC-W03
NetbiosDomainName
: TESTDOMAIN
PrincipalName
: vpc-w03.testdomain.com
SiteName
:
MaintenanceModeLastModified
: 1/1/1900 12:00:00 AM
StateLastModified
: 12/27/2007 7:04:55 AM
Parameters
: {W3SVC/1}
ManagementGroup
: TestOpsMgrGroup
ManagementGroupId
: 063e1751-ae67-b39f-f191-ad32b6df5357
Page
29
QUERY FOR ALERT PROPERTIES
Note the following alert properties:
...
MonitoringObjectId
MonitoringClassId
...
IsMonitorAlert
ProblemId
MonitoringRuleId
...
: 6aaa027f-2915-8021-e2bf-3ff0b5eec611
: 648f8c95-dd28-84dd-dc64-eb08ee364d32
: True
: ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd
: ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd
You can use additional cmdlets to get more information about these properties.
MonitoringObjectId:
>get-monitoringobject -id 6aaa027f-2915-8021-e2bf-3ff0b5eec611
Id
PathName
: 6aaa027f-2915-8021-e2bf-3ff0b5eec611
: Microsoft.Windows.InternetInformationServices.2003.WebSite%003
avpc%002dw03.testdomain.com%003bW3SVC%002f1
DisplayName
: Default Web Site
ManagementMode
:
ManagementGroup : TestOpsMgrGroup
HealthState
: Error
OperationalState :
MonitoringClassId:
>get-monitoringclass -id 648f8c95-dd28-84dd-dc64-eb08ee364d32
ManagementGroup
ManagementGroupId
Abstract
Base
:
:
:
:
TestOpsMgrGroup
063e1751-ae67-b39f-f191-ad32b6df5357
False
ManagementPackElementUniqueIdentifier=294f206e-08aa-6dc1-1bd
7-a72ce272f365
True
False
{ApplicationPoolName, ApplicationPoolID}
ClassType
Public
Microsoft.Windows.InternetInformationServices.2003.WebSite
648f8c95-dd28-84dd-dc64-eb08ee364d32
IIS 2003 Web Site
All IIS Web sites that are running on the Windows 2003 versi
on of Internet Information Services (IIS).
ENU
Hosted
Singleton
PropertyCollection
XmlTag
Accessibility
Name
Id
DisplayName
Description
:
:
:
:
:
:
:
:
:
LanguageCode
Comment
Status
LastModified
TimeAdded
:
:
: Unchanged
: 11/21/2007 4:23:13 PM
: 11/21/2007 4:23:13 PM
Page
30
For the Base property value, you can use the same get-monitoringclass cmdlet.
QUERY FOR MONITOR
If IsMonitorAlert is True, ProblemId contains the ID of the corresponding monitor. Otherwise
MonitoringRuleId contains the ID of the corresponding monitoring rule.
In the Default Web Site stopped scenario, IsMonitorAlert is True, so ProblemId contains the ID
of the monitor.
>get-monitor -criteria:"Id='ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd'"
ManagementGroup
ManagementGroupId
HasNonCategoryOverride
TypeID
:
:
:
:
ConfirmDelivery
:
OperationalStateCollection :
Configuration
:
TestOpsMgrGroup
063e1751-ae67-b39f-f191-ad32b6df5357
False
ManagementPackElementUniqueIdentifier=dfc7fdae-1e873667-8460-c2a258859f5f
False
{Good, Bad}
<PeriodInSeconds>60</PeriodInSeconds><SiteID>$Target
/Property[Type="IISCommon!Microsoft.Windows.Internet
InformationServices.WebSite"]/SiteID$</SiteID>
UnitMonitor
onEssentialMonitoring
ManagementPackElementUniqueIdentifier=648f8c95-dd2884dd-dc64-eb08ee364d32
ManagementPackElementUniqueIdentifier=a6c69968-61aaa6b9-db6e-83a0da6110ea
True
Normal
XmlTag
Enabled
Target
:
:
:
ParentMonitorID
:
Remotable
Priority
RunAs
Category
AlertSettings
:
:
:
: PerformanceHealth
: Microsoft.EnterpriseManagement.Configuration.Managem
entPackMonitorAlertSettings
: Public
: Microsoft.Windows.InternetInformationServices.2003.W
ebSite.WebSiteStatusCheck.Monitor
: ce89d4d4-8264-8c51-5cd9-a1ff0e314cdd
: A Windows Internet Information Service Web Site is U
navailable.
:
: ENU
:
: Unchanged
: 11/21/2007 4:23:13 PM
: 11/21/2007 4:23:26 PM
Accessibility
Name
Id
DisplayName
Description
LanguageCode
Comment
Status
LastModified
TimeAdded
Note that for the get-monitor cmdlet above, the "Id" for criteria is case sensitive.
The TypeID perperty value contains the ID for the monitor’s type. In this case, this is a
UnitMonitor as see from the XmlTag property value.
For the Target GUID, you can use get-monitoringclass cmdlet.
Page
31
For the ParentMonitorID GUID, you can use get-monitor cmdlet.
QUERY FOR MONITORING RULE
If IsMonitorAlert is False, the alert is from a monitoring rule, in which case the
MonitoringRuleId contains the ID of the monitoring rule.
Instead of stopping the Default Web Site in the test scenario, you can try stopping the OpsMgr
Health Service. The resulting alert from TestConn will be similar to below:
#1 Alert received on 12/30/2007 12:58:56 AM
>> Id: 45572286-77a9-40ba-9ec1-024d02d721e9
>> Category: Alert
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: Pending
>> RepeatCount: 0
>> ResolutionState: 0
>> LastModified: 12/29/2007 1:42:44 PM
>> LastModifiedByNonConnector: 12/29/2007 1:42:44 PM
>> Priority: Normal
>> Severity: Error
>> Description: The root health service (Healthservice) has either stopped or pa
used soon after Sat, 29 Dec 2007 13:39:50 GMT. This adversly affects all availab
ility calculation for the entire management group.
Run the get-alert cmdlet with the alert ID:
>get-alert -id 45572286-77a9-40ba-9ec1-024d02d721e9
Id
Name
Description
MonitoringObjectId
MonitoringClassId
MonitoringObjectDisplayName
MonitoringObjectName
MonitoringObjectPath
MonitoringObjectFullName
IsMonitorAlert
ProblemId
MonitoringRuleId
ResolutionState
Priority
Severity
Category
Owner
ResolvedBy
TimeRaised
TimeAdded
LastModified
: 45572286-77a9-40ba-9ec1-024d02d721e9
: Root Health Service stopped.
: The root health service (Healthservice) has e
ither stopped or paused soon after Sat, 29 De
c 2007 13:39:50 GMT. This adversly affects al
l availability calculation for the entire man
agement group.
: 895bd899-3400-4077-5858-55b9dfa805f8
: ab4c891f-3359-3fb6-0704-075fbfe36710
: vpc-w03.testdomain.com
:
: vpc-w03.testdomain.com
: Microsoft.SystemCenter.HealthService:vpc-w03.
testdomain.com
: False
: a1297c9f-b5bc-e817-ec77-cc246008d2af
: a1297c9f-b5bc-e817-ec77-cc246008d2af
: 0
: Normal
: Error
: Alert
:
:
: 12/29/2007 1:41:57 PM
: 12/29/2007 1:41:57 PM
: 12/29/2007 1:42:44 PM
Page
32
LastModifiedBy
TimeResolved
TimeResolutionStateLastModified
CustomField1
CustomField2
CustomField3
CustomField4
CustomField5
CustomField6
CustomField7
CustomField8
CustomField9
CustomField10
TicketId
Context
ConnectorId
LastModifiedByNonConnector
MonitoringObjectInMaintenanceMode
MonitoringObjectHealthState
ConnectorStatus
RepeatCount
NetbiosComputerName
NetbiosDomainName
PrincipalName
SiteName
MaintenanceModeLastModified
StateLastModified
Parameters
ManagementGroup
ManagementGroupId
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
:
Connector Framework Alert Write Action
12/29/2007 1:41:57 PM
6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
12/29/2007 1:42:44 PM
False
Success
SuccessfullyForwarded
0
VPC-W03
TESTDOMAIN
vpc-w03.testdomain.com
1/1/1900 12:00:00 AM
12/29/2007 1:33:02 AM
{}
TestOpsMgrGroup
063e1751-ae67-b39f-f191-ad32b6df5357
In this case IsMonitorAlert is False. You can use get-rule cmdlet with the MonitoringRuleId to
get more information about the monitoring rule:
>get-rule -id a1297c9f-b5bc-e817-ec77-cc246008d2af
ManagementGroup
ManagementGroupId
HasNonCategoryOverride
Enabled
Target
:
:
:
:
:
ConfirmDelivery
Remotable
Priority
DiscardLevel
Category
ConditionDetection
DataSourceCollection
WriteActionCollection
XmlTag
Name
:
:
:
:
:
:
:
:
:
:
Id
DisplayName
Description
TestOpsMgrGroup
063e1751-ae67-b39f-f191-ad32b6df5357
False
true
ManagementPackElementUniqueIdentifier=9189a49e-b2de-cab0
-2e4f-4925b68e335d
True
True
Normal
100
Alert
{EventDS}
{GenerateAlert}
Rule
Microsoft.SystemCenter.SDKService.PrincipleManagementSer
verDown.Alert
: a1297c9f-b5bc-e817-ec77-cc246008d2af
: Root Management Server Unavailable
: Alert generating rule for when the Root Management Serve
r is not reachable from this Management Servers SDK serv
ice.
Page
33
LanguageCode
Comment
Status
LastModified
TimeAdded
:
:
:
:
:
ENU
Unchanged
11/21/2007 3:54:25 PM
11/21/2007 3:54:28 PM
QUERY FOR MANAGEMENT PACK
To get the an alert’s corresponding management pack, notice the Management Pack ID from
the Alerts sample output:
>> Management Pack Id: 7a920be5-d53c-fa2d-07a8-b415265e95b0
>> Id: 3a07c24d-a13c-43b3-be44-f6cab6ecffb3
>> Category: PerformanceHealth
>> ConnectorId: 6a1f8c0e-b8f1-4147-8c9b-5a2f98f10003
>> ConnectorStatus: SuccessfullyForwarded
>> RepeatCount: 0
>> ResolutionState: 0
>> LastModified: 12/14/2007 5:46:19 AM
>> LastModifiedByNonConnector: 12/14/2007 5:46:19 AM
>> Priority: Low
>> Severity: Error
>> Description: The Internet Information Services Web Site named W3SVC/1 is unav
ailable as the site has been stopped.
You can use get-managementpack cmdlet with the ID to get more information about the
management pack:
>get-managementpack -id 7a920be5-d53c-fa2d-07a8-b415265e95b0
Name
TimeCreated
LastModified
KeyToken
Version
Id
VersionId
References
:
:
:
:
:
:
:
:
Sealed
ContentReadable
FriendlyName
DisplayName
Description
:
:
:
:
:
DefaultLanguageCode :
LockObject
:
Microsoft.Windows.InternetInformationServices.2003
11/21/2007 4:23:13 PM
11/21/2007 4:23:13 PM
31bf3856ad364e35
6.0.5000.0
7a920be5-d53c-fa2d-07a8-b415265e95b0
5c1a10e7-8776-44fc-5713-6f462352ebe8
{Microsoft.SystemCenter.DataWarehouse.Library, Microsoft.Wi
ndows.InternetInformationServices.CommonLibrary, Microsoft.
Windows.Library, System.Performance.Library...}
True
True
Windows Internet Information Services 2003
Windows Server Internet Information Services 2003
Microsoft Windows Server Internet Information Services 2003
Management Pack: This management pack discovers and monito
rs Windows Server Internet Information Services 2003.
ENU
System.Object
Page
34
Page
35
REFERENCES
System Center Operations Manager 2007 SDK
How to Create Outbound Connectors
Operations Manager 2007 Key Concepts Guide
Operations Manager 2007 Quick Start Guide
Microsoft Windows Server 2000/2003 Internet Information Services Management Pack
Microsoft Windows Internet Information Services Management Pack Guide
Latest Management Packs
Latest Management Pack Guides
BLOGS
Operations Manager Product Team Blog
Jakub@Work
OpesMgr++
Notes on System Center Operations Manager
OpsMgr, SCE And MOM Blog
Matt Goedtel on Operations Management
System Center Operations Manager Command Shell
NEWSGROUPS
Look for microsoft.public.opsmgr newsgroups on
http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx
<><><>
Page
36
Download