Export (0) Print
Expand All
2 out of 4 rated this helpful - Rate this topic

Getting Started Developing an SDK Client Application

System Center

Updated: May 22, 2009

Applies To: Operations Manager 2007 R2, Operations Manager 2007 SP1, System Center Operations Manager 2007

To get started using the Operations Manager SDK, create a new project in Visual Studio, and, in your project, add references to the following Operations Manager class libraries:

  • Microsoft.EnterpriseManagement.OperationsManager.dll

  • Microsoft.EnterpriseManagement.OperationsManager.Common.dll

The class libraries allow you to programmatically access Operations Manager data and functionality.

These assemblies are installed in the %ProgramFiles%\System Center Operations Manager 2007\SDK Binaries directory when you install Operations Manager 2007.

After you add references to the Operations Manager class libraries, create a connection to the SDK Service. The SDK Service is a Windows service that runs on the Root Management Server in a Management Group.

You can create a connection to the SDK Service by using the Connect method. This method returns a ManagementGroup object, which is the primary object for accessing most Operations Manager features and data. For more information, see How to Connect an Operations Manager SDK Client to the SDK Service.

Accessing Operations Manager Data

The Operations Manager class libraries provide classes that contain methods for accessing the data from an SDK client application. For example, to get information about the Management Packs installed in a Management Group, you can use the GetManagementPacks method. The method returns a read-only collection of ManagementPack objects, each of which contains data about a specific Management Pack.

For more information about the Operations Manager classes, see Operations Manager 2007 R2 SDK Reference.

The following example shows how to access Operations Manager data by using the ManagementGroup class. This example gets the alerts for all the Windows computers in the management group and displays the health state of the computer.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Xml;
using Microsoft.EnterpriseManagement.Monitoring.Security;

namespace SDKSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            ReadOnlyCollection<PartialMonitoringObject> windowsComputerObjects;
            ManagementGroup managementGroup;
            MonitoringClass windowsComputerClass;

            managementGroup = new ManagementGroup("localhost");

            windowsComputerClass = managementGroup.GetMonitoringClass(SystemMonitoringClass.WindowsComputer);

            windowsComputerObjects = managementGroup.GetPartialMonitoringObjects(windowsComputerClass);

            foreach (PartialMonitoringObject windowsComputerObject in windowsComputerObjects)
            {
                ReadOnlyCollection<MonitoringAlert> alerts;

                alerts = windowsComputerObject.GetMonitoringAlerts();

                Console.WriteLine("{0} - State: {1} - Number of alerts: {2}",
                                  windowsComputerObject.DisplayName,
                                  windowsComputerObject.HealthState.ToString(),
                                  alerts.Count);

                foreach (MonitoringAlert alert in alerts)
                {
                    Console.WriteLine("{0}", alert.Name);
                }
            }
        }
    }
}

Additional Information

See Also

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.