The Operations Manager class libraries provide classes to encapsulate data for Operations Manager components and methods for accessing the data from an SDK client. For example, to get information about the Management Packs that are installed in a Management Group, you can use the GetManagementPacks method. The method returns a read-only collection of Microsoft.EnterpriseManagement.Configuration.ManagementPack objects, each of which contains data about a specific Management Pack.
Filtering Data
Many of the methods that retrieve Operations Manager data accept a criteria object as an argument. Criteria objects use a string expression to filter the results that are returned by the method.
For example, to narrow the results that are returned by the GetManagementPacks method, you can construct a Microsoft.EnterpriseManagement.Configuration.ManagementPackCriteria object to filter the Management Packs by name, as follows:
C# | Copy Code |
---|---|
string qStr = "Name = 'Microsoft.SystemCenter.NTService.Library'"; ManagementPackCriteria mpCriteria = new ManagementPackCriteria(qStr); ReadOnlyCollection<ManagementPack> mps = mg.GetManagementPacks(mpCriteria); |
In this example, the method queries the data for a single Management Pack with a specific name.
Getting Valid Properties for Use in Criteria Expressions
The properties that you can use in the criteria expression vary depending on the type of objects that are returned by the method. In the previous example, the expression used the Management Pack's Name property to filter the results. Other Management Pack properties that could have been used include Id, Sealed, Version, LastModified, and TimeCreated (among others).
You can obtain a list of the valid properties for any criteria type by using the GetValidPropertyNames method. For example, to obtain a collection of valid property names for use in defining a criteria expression, you could use the following method:
C# | Copy Code |
---|---|
ReadOnlyCollection<string> validProperties = ManagementPackCriteria.GetValidPropertyNames(); |
If a criteria expression is not valid, the SDK Service throws an Microsoft.EnterpriseManagement.Common.InvalidCriteriaException, which you can catch in your SDK client to revise the expression.
For information about the operators you can use in criteria expressions, see Criteria Expression Syntax.
Examples
The following topics contain query criteria examples:
How to Query for All Monitoring Objects in an Error State
How to Query for All Rules That Have a Non-Category Override
See Also
Concepts
Getting Started Developing an SDK Client ApplicationOther Resources
Using Operations Manager Data QueriesSend comments about this topic to Microsoft.