MonitoringObjectCriteria Class
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Specifies the criteria for the GetMonitoringObjects method and the GetRelatedMonitoringObjects method, limiting the returned objects to those that meet the criteria.
Namespace: Microsoft.EnterpriseManagement.Monitoring
Assembly: Microsoft.EnterpriseManagement.OperationsManager (in Microsoft.EnterpriseManagement.OperationsManager.dll)
Usage
'Usage
Dim instance As MonitoringObjectCriteria
Syntax
'Declaration
Public Class MonitoringObjectCriteria
Inherits EnterpriseManagementObjectCriteria
public class MonitoringObjectCriteria : EnterpriseManagementObjectCriteria
public ref class MonitoringObjectCriteria : public EnterpriseManagementObjectCriteria
public class MonitoringObjectCriteria extends EnterpriseManagementObjectCriteria
public class MonitoringObjectCriteria extends EnterpriseManagementObjectCriteria
Example
The following example demonstrates an instance of the MonitoringObjectCriteria class.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Common;
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
You can get a list of the property names that can be used in the criteria expression by using the GetValidPropertyNames method. For information about the criteria expression syntax, see Criteria Expression Syntax.
Inheritance Hierarchy
System.Object
Microsoft.EnterpriseManagement.Common.QueryCriteria
Microsoft.EnterpriseManagement.Common.EnterpriseManagementObjectCriteria
Microsoft.EnterpriseManagement.Monitoring.MonitoringObjectCriteria
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
MonitoringObjectCriteria Members
Microsoft.EnterpriseManagement.Monitoring Namespace