次の方法で共有


PartialMonitoringObject 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 that is a partial instance of a monitoring class.

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

Usage

'Usage
Dim instance As PartialMonitoringObject

Syntax

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

Example

The following example shows how to get the computers that are running Windows operating systems in a management group and how to 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);

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

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

Remarks

The PartialMonitoringObject class is the base class for the MonitoringObject class and the PartialMonitoringObjectGroup class.

A partial monitoring object is an object for which only the standard set of monitoring object properties is defined. Any custom properties of the object's class are omitted. Because the Operations Manager database omits custom property values when responding to the query, using partial monitoring objects decreases the load on the database and improves query performance.

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.PartialMonitoringObjectGroup

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

PartialMonitoringObject Members
Microsoft.EnterpriseManagement.Monitoring Namespace

Other Resources

Defining Queries for Monitoring Objects