MonitoringAlert Class

System Center

Updated: April 16, 2012

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents an Operations Manager monitoring alert. In Operations Manager, an alert is an item that indicates that a predefined situation has occurred on a monitored object. Alerts are defined by rules.

Namespace: Microsoft.EnterpriseManagement.Monitoring
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in Microsoft.EnterpriseManagement.OperationsManager.dll)

'Usage
Dim instance As MonitoringAlert

[SerializableAttribute] 
public ref class MonitoringAlert : public OperationalDataObject
/** @attribute SerializableAttribute() */ 
public class MonitoringAlert extends OperationalDataObject
SerializableAttribute 
public class MonitoringAlert extends OperationalDataObject

The following example shows how to get the Windows computers in a Management Group and display the health state and number of alerts for each computer.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Common;
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)
        {

            ManagementGroup managementGroup = new ManagementGroup("localhost");
            ManagementPackClass windowsComputerClass = managementGroup.EntityTypes.GetClass(SystemMonitoringClass.WindowsComputer);

         
            List<PartialMonitoringObject> windowsComputerObjects = new List<PartialMonitoringObject>();
            IObjectReader<PartialMonitoringObject> reader = managementGroup.EntityObjects.GetObjectReader<PartialMonitoringObject>(windowsComputerClass, ObjectQueryOptions.Default);
            windowsComputerObjects.AddRange(reader);

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

                alerts = windowsComputerObject.GetMonitoringAlerts(
                    Microsoft.EnterpriseManagement.Common.TraversalDepth.Recursive);

                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);
                }
            }
        }
    }
}

The MonitoringAlert class contains information about an alert in Operations Manager. Alerts are used to notify operators of problems. Alerts are driven by event processing rules or scripts. An alert tells you when something significant happened in one of your systems. You can monitor alerts to determine the significance of an alert and the corrective action to be taken.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

 

Community Additions

ADD
Show: