cmdbdriver script - Query by path example
This example shows a
cmdbdriver script that queries related configuration items (CIs) using the
init log log MyUser MyUser MyUser MyUser MyServer cqq PersonQueryQual 4 1 Name 1 4 Daisy cqobj BMC.CORE BMC_Person PersonQueryObj PersonQueryObj 1 1 PersonQueryQual PersonQueryQual PersonQueryQual qbp BMC.ASSET BMC.ASSET 1 PersonQueryObj PersonQueryObj 1 1 PersonQueryObj 1 Name 1 BMC_Person BMC_Person PersonQueryObj Name 1 1 1 2 2
In the preceding example, the script first creates a query qualifier using the
cqq command. The alias for the query qualifier is specified as
PersonQueryQual. The query qualification in this example is a Simple query that searches for an instance of
BMC_Person class with Name = 'Daisy' in the
A query qualifier can be reused any number of times within a specific session. After a
cmdbdriver session terminates, the query qualifier that you created within the session is no longer available.
The value of 1 in the query qualification instructs the query to perform an "Equal to" operation and 4 indicates that the right operand for the query is a value. The query constructed in the query qualification is
Name = 'Daisy'.
In the query object, you specify the namespace and class information. The alias for the query object is
PersonQueryObj. The first value of 1 after the
PersonQueryObj line instructs the query to search for a CI class. The next value of 1 instructs the query to use the existing
PersonQueryQual query qualification object.
The blank value after the query qualifier name is for the source node alias. The query qualification in this example does not involve an input of multiple nodes in a graph format. Therefore, this parameter is left blank. The subsequent values of 1 and 1 specify that the query is to be performed on a CI class and that the query must use an existing query object. The alias for the query qualification object is then specified. The blank values indicate that there is no explicit join to perform in the query.
qbp command takes the input of the dataset, which is
BMC.ASSET in this example. The dataset mask is specified as none with a blank line. The
Query_Object_Selector_List parameters are then specified. The attribute to fetch in the query is specified as Name. The results are sorted by the Name attribute in an ascending order.