Creating a graph query to search for a CI
To create a graph query to search for a CI
- In the CMDB Dashboard UI, select New Query from the list of search queries.
The New Query window is displayed. - Drag and drop classes into the right pane.
- Add relationships between those classes in accordance with the query qualifications.
To add a relationship, click the triangular icon below the source class.
Move your mouse and extend the arrow from the source class to the destination class, and click the destination class.
The Select relationship between classes dialog box is displayed. - Select the relation type between the source and destination classes.
Only valid relationship types are available for selection in the list. - Specify the cardinality information:
By default, the Required check box is selected.
In this example, the query returns results only if a computer system has an application running on it.- (Optional) Select the Minimum value.
By default, the minimum value is 1.
You can change it to any other value. - (Optional) Select the Maximum value.
The default value is '*' (unrestricted).
Select the Specify Value check box and specify a maximum value.
For example, if you specify the minimum value as 2 and maximum value as 4, the query returns computer systems that have at least two applications and up to four applications running on them.
For more information on Cardinality, see Cardinality. - (Optional) To set the impact direction for the relationship, turn on the Set Impact toggle key and select an impact direction.
- Save the details.
- (Optional) Select the Minimum value.
- (Optional) You can include additional qualifications for a class by clicking Edit Class Qualification
.
In this example, for a computer system class, you must include a qualification that assigns a Payroll value to the Department attribute.
The Qualification Builder opens.
Use the qualification builder to add a qualification.
For more information, see Qualification-Builder-overview. - Repeat steps 2 to 10 to add the remaining classes and create relationships. In this example, you must add the Patch class.
The complete query is shown in the following figure. - When you finish creating the query, test your query by clicking Validate and search.
Validate and search is enabled only after you create a relationship between at least two classes.
If the search results do not provide any results, you can change the dataset on which you are searching. - Specify a category under which you want to save the query, a name and a description for the query.
- (Optional)To save the query as a personal query, turn on the Is Personal toggle key.
By default, the query is saved as a shared query. - To save the changes, click Save query.
To create a search query with optional query definition
While creating a search query, if you clear the Required checkbox, the cardinality is not considered, which makes query definition as optional.
In this example, if you specify the cardinality as not required between the application class and patch class, the query returns all computer systems that have any application running on them, irrespective of whether a patch is installed on them or not.
However, it does not return that computer system that has patch 2 installed on them. A sample query result is shown in the following figure:
The following video (5.05 min) shows you how you can create search queries to search for CIs in BMC CMDB:
Editing a search query
You can edit a search query at any time to include any changes.
To edit a search query
- From the Quick Search drop down list on the CMDB Dashboard, select the query that you want to edit.
- (Optional) To edit a relationship, click Edit
for the relationship.
The Select relationship between classes dialog box opens.
You can select a relationship or change the cardinality and save the changes. - (Optional) To add a qualification or edit a qualification for a class or for the relationship, click Edit class qualification
.
For example, if you have added an impact direction to a relationship earlier, but you want to change the relationship now, you cannot change it using the Select relationship between classes dialog box. You must change the impact direction from the qualification builder as shown in the following figure. - (Optional) To change the class from which you want the search query to return results, click Return CIs from class
for that class (CI).
For example, if the BMC_ComputerSystem class is selected then the search result returns CIs from that class if present in the dataset on which this query is run. - After making the changes, click Validate and search.
You have an option to update the details of the query and save it, or save a copy of the query.- If you click Update, the existing query details are updated with the changes that you have made.
- If you click Save copy, a copy of the query is created with the changes that you have made.
To find CIs by using a graph query
You can create your own queries to search for CIs by specifying criteria, save the queries and reuse them.
- On CMDB Portal, expand the query list and select the search query.
- Select the dataset for which you want to perform the search.
- Click Validate and search.
The CIs that match the search criteria are displayed in the search results.
Accessing search queries that were created in Atrium Core Console from the CMDB UI
Search queries that are created in the Atrium Core Console can be viewed and edited in the graphical query builder but all the features of that query cannot be used in the CMDB UI. For example, you can create queries with parameters, bidirectional queries, or queries with folding rules in the Atrium Core Console, but after you open these queries in the graphical query builder and save the query, the query is saved in the new format. Queries with parameters, bidirectional queries, and queries with folding rules are not supported in the CMDB UI. These queries may not return the desired results.
Create a loop in a search query
While creating a query, you cannot connect a parent class to a child class and then create another relationship between the child class and the parent class. If you try to create a loop, an error is displayed as shown in the following figure: