Share via


MonitoringObject Class

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

Represents a monitoring object and provides access to its properties, state, as well as related monitoring objects.

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

Usage

'Usage
Dim instance As MonitoringObject

Syntax

'Declaration
<SerializableAttribute> _
Public Class MonitoringObject
    Inherits PartialMonitoringObject
    Implements IEnterpriseManagementObjectCreatable(Of MonitoringObject)
[SerializableAttribute] 
public class MonitoringObject : PartialMonitoringObject, IEnterpriseManagementObjectCreatable<MonitoringObject>
[SerializableAttribute] 
public ref class MonitoringObject : public PartialMonitoringObject, IEnterpriseManagementObjectCreatable<MonitoringObject^>
/** @attribute SerializableAttribute() */ 
public class MonitoringObject extends PartialMonitoringObject implements IEnterpriseManagementObjectCreatable<MonitoringObject>
SerializableAttribute 
public class MonitoringObject extends PartialMonitoringObject implements IEnterpriseManagementObjectCreatable<MonitoringObject>

Example

The following example gets a collection of monitoring objects and outputs their states and names.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement.Common;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Configuration.IO;
using Microsoft.EnterpriseManagement;
using System.Collections.ObjectModel;
using Microsoft.EnterpriseManagement.Administration;
using Microsoft.EnterpriseManagement.Monitoring;

namespace SDKSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            ManagementGroup mg = new ManagementGroup("localhost");
            ManagementPackClass computerMonitoringClass = mg.EntityTypes.GetClass(SystemMonitoringClass.WindowsComputer);
            EnterpriseManagementObjectCriteria criteria = new EnterpriseManagementObjectCriteria(string.Format("HealthState='{0}'", (int)HealthState.Error), computerMonitoringClass);
        
            List<MonitoringObject> monitoringObjects = new List<MonitoringObject>();
            IObjectReader<MonitoringObject> reader = mg.EntityObjects.GetObjectReader<MonitoringObject>(criteria, ObjectQueryOptions.Default);
            monitoringObjects.AddRange(reader);

            foreach (MonitoringObject monitoringObject in monitoringObjects)
            {
                Console.WriteLine("Object Name: {0}", monitoringObject.DisplayName);
                Console.WriteLine("In Error State since: {0}", monitoringObject.StateLastModified.Value.ToLocalTime().ToString());
            }
        }
    }
}

Remarks

A monitoring object is an instance that is discovered by Microsoft System Center Operations Manager. For more information about this class, see Monitoring Object and Partial Monitoring Object Comparison.

Inheritance Hierarchy

System.Object
   Microsoft.EnterpriseManagement.Common.MonitoringBase
     Microsoft.EnterpriseManagement.Common.MonitoringBaseWithId
       Microsoft.EnterpriseManagement.Common.EnterpriseManagementBase
         Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectBaseWithProperties
           Microsoft.EnterpriseManagement.Common.EnterpriseManagementObject
             Microsoft.EnterpriseManagement.Monitoring.PartialMonitoringObjectBase
               Microsoft.EnterpriseManagement.Monitoring.PartialMonitoringObject
                Microsoft.EnterpriseManagement.Monitoring.MonitoringObject
                   Microsoft.EnterpriseManagement.Monitoring.MonitoringObjectGroup

Thread Safety

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

Platforms

Development Platforms

Windows Vista, Windows Server 2003, and

Target Platforms

Change History

See Also

Reference

MonitoringObject Members
Microsoft.EnterpriseManagement.Monitoring Namespace