Infrastructure management using the HP SIM command line interface (436331-002, January 2009)

contains
ends with
does not end with
is equal to
is not equal to
starts with
Because CriteriaByNameComparison is a text criteria, and the operators apply to text fields in
the database only. Other criteria are selection criteria, and their operators are is and is not, since
selection criteria are the specific values being compared, not free-form text.
In the example, CriteriaByNameComparison is a text criteria and does not have any values.
However, the criteria ProductByName is a selection criteria. To find the values of this criteria, enter:
# mxquery –l val ProductByName
There are two additional options for the mxquery –l command.
The n option displays a list of all the query collections in HP SIM.
The t option displays all the query collections in a tabular format, showing the query ID, query
name, query type, and query owner.
To create a new query collection in HP SIM, first create a file that contains the XML definition for the
query collection. Using the example above, the XML is placed in a file called testquery.xml. To add
the query collection to HP SIM, use the following command:
# mxquery –a –f testquery.xml
You can have more than one query collection definition in the XML file. The mxquery command
processes the defined queries. If a query definition has an error, that definition is skipped and does
not impact the processing of the other definitions.
The XML field category-name defines where in the collection hierarchy the query resides. In the
example query, the collection will reside in the collection SysSharedLists, which is the Shared
collection in the HP SIM collection hierarchy.
You can also use the XML file to modify one or more query collections after they are added to HP
SIM, by using the command:
# mxquery –m –f testquery.xml
Only query collection definitions that are modified in testquery.xml are processed. To remove
query collections created in the example from HP SIM, execute one of the following:
# mxquery –r “Test Query”
# mxquery –r –f testquery.xml
The first example removes the query collection Test Query. The second example removes the entire
query collections defined in the file testquery.xml.
After adding your query collections to HP SIM, you can execute the query collections from the
command line by entering the following command:
# mxquery –e “Test Query”
The output appears as a list displaying the information for each system that matches the query criteria.
Since it is possible for many systems to match the query criteria, HP recommends that you redirect the
output using the –e
option to a file for further processing. The following example shows the output for
one system from the example query, Test Query.
NoticeID: 602
HWStatus: 1
MPStatus: 0
10