How to Query for Overrides
Applies To: System Center 2012 - Operations Manager
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Overrides adjust the configuration of Operations Manager monitoring settings for monitors, attributes, object discoveries, and rules. You can query for overrides by defining criteria in the Microsoft.EnterpriseManagement.Configuration.ManagementPackOverrideCriteria class constructor. The criteria syntax is defined in Criteria Expression Syntax. The following property names are valid names that can be used in the criteria expression:
Id
Name
ManagementPackId
TargetId
ContextId
ContextObjectId
Value
Enforced
DisplayName
Description
TimeAdded
LastModified
Category
The following code queries for all the overrides that are enforced:
/// <summary>
/// Query for overrides.
/// </summary>
using System;
using System.Collections.Generic;
using Microsoft.EnterpriseManagement;
using Microsoft.EnterpriseManagement.Configuration;
using Microsoft.EnterpriseManagement.Monitoring;
namespace SDKSamples
{
class Program
{
static void Main(string[] args)
{
ManagementGroup mg = new ManagementGroup("localhost");
// The criteria specifies that you want to collect
// all the overrides that are enforced.
ManagementPackOverrideCriteria overrideCriteria =
new ManagementPackOverrideCriteria(
"Enforced = 1");
Console.WriteLine("Querying for data...");
IList<ManagementPackOverride> overrides =
mg.Overrides.GetOverrides(overrideCriteria);
// Display information about each override.
foreach (ManagementPackOverride mpOverride in overrides)
{
Console.WriteLine("Override name: " + mpOverride.Name);
Console.WriteLine("Status: " + mpOverride.Status);
Console.WriteLine("Context: " + mpOverride.Context.Name);
Console.WriteLine("Description: " + mpOverride.Description +
Environment.NewLine);
}
}
}
}