Creating a graph query to search for a CI
You can create a search query by using the graphical query builder, save the query, edit the query, and use it to search for CIs.
Jonnie, a system administrator in Calbro Services wants to install patch 2.0 of an antivirus software on computers belonging to the Payroll department. He creates a query that looks up for all computers that have the antivirus software installed on them, but not having the patch 2.0 of the software installed on them.
He can reuse this query later on by editing the patch details to install another patch on the same computers. He can also share this query with system administrators of other departments. They can edit the computer system class details to install this patch on computers in their department.
This query includes the
BMC_ComputerSystem CI class, the
BMC_Component relationship class, the
BMC_Application class, and the
For each class, Jonnie can create one or more query conditions based on the attributes of that class. For example, a query for computer systems might include several conditions for the
BMC_ComputerSystem class (
Name, Department attributes) and other conditions for the
BMC_Patch class (
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) 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
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
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
The Select relationship between classes dialog box opens.
You can select a relationship or change the cardinality and save the changes. for the relationship.
- (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 example, if the
BMC_ComputerSystemclass is selected then the search result returns CIs from that class if present in the dataset on which this query is run. for that class (CI).
- 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.
- Page not found for multiexcerpt macro.
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: