Querying the CMDB

The CMDB Query Builder allows you to easily build complex infrastructure and service queries that span multiple CMDB classes, and that involve many CIs that are connected by different relationships.

The CMDB Query Builder provides a canvas into which you drag the CI classes and other artifacts that you want to include in a query. Then you add relationships, AND/OR operators between the CI classes, and define the relationship properties to query for. You can use saved queries to populate a CMDB group with CIs, and then use scriptable APIs to retrieve the CI list and apply actions collectively to all the CIs in the group.

There are two query types: CMDB Query and a Service Mapping query, which you can use separately or in combination to create queries such as:

  • All CIs of a certain type in a business service. For example, all Apaches/Web Servers/Linux servers per service.
  • All virtual servers and the physical servers that host them.
  • All servers that are not mapped to any business service.
  • All Servers with a database.
  • All database servers that are included in any business service or in a particular business service.
  • All business services and their associated servers and the cost of each server. This query helps evaluate the cost of technology for each business service

The Query Builder uses the concept of start node which is the starting point of the query and is noted by gray background in its query node. The first class that you drag to the canvas becomes automatically the start node of the query and you cannot select a different start node. In a complex query, the start node must always be the only node connected to an AND/OR operator. If you try to connect a second node to an operator that the start node is connected to, the query fails to run and you will be prompted to select a different start node.

CMDB Query

A query type that queries the infrastructure for CI classes, and the relationships and references that connect them.

Service Mapping Query

A query type that queries business services and technical services, and thus requires that Service Mapping is activated. The query is framed within a business service map. You define a pattern, and query for business service maps that have that pattern in their definition. The relationships in Service Mapping queries are matched by single-level direct relationships which is similar to the CMDB queries, and in addition, they are also matched by multi-level indirect relationships if they exist. A query for a relationship between two CI classes is satisfied even if the two CI classes are connected by intermediate CI classes that are not specified in the query.

Combination Query

You can combine the two query types by incorporating a saved Service Mapping query into a CMDB query. For example, create a CMDB query for Windows Servers that are connected to Tomcat WAR. Then connect the Tomcat WAR CI class to a Service Mapping query. This changes the query to find Windows Servers that are connected to Tomcat WAR which is included in the services that returned by the Service Mapping query. You can inverse that query by choosing - Does Not Belong To Service. This changes the query to find Windows Servers that are connected to Tomcat WAR that is not included in services returned by the Service Mapping query.

Relationship properties

When you connect CI classes on the canvas, the CMDB Query Builder displays the Connection Properties dialog box where you can choose from a list of relationships that exist between these two CI classes including relationships to descendent classes. For Service Mapping queries, only related and not-related connections are displayed.

The relationship arrow on the canvas shows the direction of the query, but the connection properties for the relationship determine what the relationship is queried for.

Connection properties include:
  • Parent/child direction: Which CI class is the parent and which CI class is the child in the relationship.
  • No relations: Query for a CI class which has no relation to the class it is connected to.
  • References fields: A field that the parent and ancestor parent CI classes use to reference the child CI class.

Newly added relationships between CI classes may take up to 30 minutes to appear in the relationship list.