Build a CMDB query using the CMDB Query Builder - Product Documentation: Utah (2024)

A CMDB query type that queries the infrastructure for CI classes and optionally\n non-CMDB tables, and the relationships and references that connect them.

\n\n

\n

The Core UI plugin (com.glide.ui.ui16) must be\n activated.

\n\n

Role required: cmdb_query_builder_read to only view and run saved queries, and\n cmdb_query_builder (contained for itil, itil_admin, and asset) to create and save\n queries, modify saved queries, and run queries.

\n\n

Authorized users can update and delete a\n query created by another user.

\n\n

\n\n

\n

Build the query by dragging the CI classes and non-CMDB tables that you want to\n include in the query. Then dropping them as nodes on the canvas, and defining\n relationship properties between them. You can filter on the attributes of any node\n to narrow down the results to a specific set of CIs of that class or to a single\n specific CI. You can also select which property columns appear in the query\n results.

\n\n

As you step through building a query, list options and other user interface elements\n of the CMDB Query Builder, are dynamically filtered as appropriate to your\n selections.

\n\n

To learn more about using Query Builder, see the CMDB Query Builder Queries and Reporting - Platform Analytics Academy\n ServiceNow Community video. For a step-by-step walk through of building CMDB queries in the Query Builder, including queries with application services, see Sample queries.

\n\n

\n\n

  1. \n Navigate to All > Configuration and click CMDB Query Builder.\n
  2. \n On the CMDB Query Builder page do either of the\n following steps:\n
    • Click Create new. Type in a\n Name, choose CMDB Query as\n the Query type, and then click\n Create.
    • Click a widget of a saved query to continue building an existing query.\n Search saved queries first if needed.
    • Point to the upper right corner of a saved query widget, and click the\n Duplicate Query icon to edit a copy of a saved\n query. The default name of the new query contains the string\n 'copy'.
    \n\n
  3. \n On the canvas, you can do any of the following operations:\n

    \n

    • Add CI classes to the query: On the CMDB Classes\n tab, select classes from the hierarchy list and drag them to the\n canvas.
    • Add an Application Service CI to the query: On the CMDB\n Classes tab, select the Application\n Service class from the hierarchy list and drag it to\n the canvas.

      \n\n

      In Application Service\n Properties on the right-side bar, you can select Convert\n attached nodes to pattern to query on patterns\n between the application service and other CMDB class nodes. When\n querying on a pattern, the nodes on both ends of the pattern\n connection, can be any number of levels apart. If Convert\n attached nodes to pattern is not selected, then the\n connection between the application service node and other CMDB class\n nodes, represent direct relationships.

      \n
    • Add non-CMDB tables to the query: Select a table from the\n Non-CMDB Tables list and drag it to the\n canvas.

      Note: A non-CMDB table cannot be the starting node in the\n query.

      \n
    • Add connections (relationships or patterns for application services)\n between two nodes on the canvas:

      1. On the first node in the connection, click the small square\n at the center of the right side.
      2. On the second node in the connection, click the small square\n at the center of the left side to create the\n connection.

      \n

      \n\n

      \n

      Table 1. Connection UI Notations
      NotationDescription
      Full lineA relationship in a CMDB query.
      Red asterisk at the center of the connection\n lineInformation such as relationship type is\n missing, invalidating the query.
      Levels:<n>\n Types:<n> or a\n <Reference type>\n notation on the connection line

      As applicable: The number of relationship\n levels and the number of relationship types\n included for the connection. Or, a reference type\n for a relationship that is a reference.

      \n
      Dashed lineA pattern connection between an application\n service node and another node.

      \n

      \n

      \n
    • In Connection Properties on the right-side bar, configure relationship\n settings (click the connection line if necessary):
      1. In the Relationship Direction section, select the\n Parent node (the\n Child node automatically\n adjusts).
      2. In the Relationship Levels section, set\n Level to First level\n relationships if the CIs are directly connected.\n Or, Up to 2nd level relationships if the\n CIs are connected either directly or indirectly through another\n CI.
      3. In the Relationship Types and Related Items section, select\n either option:\n

        OptionDescription
        No\n RelationshipsTo query for CIs with no connecting\n relationships, such as All Tomcat WAR CIs\n which are not connected to a Windows\n Server.
        Add Relationship\n TypesTo select specific or any relationship\n type.
        Add a Related\n ItemTo query for related CIs between the\n nodes.

        \n

        \n

        \n
      \n
    • Configure CI reference column for a connection to a non-CMDB table: In\n the Connection Properties right-side bar, in the CI Reference Column\n section, select the column with a reference to a CI from the\n Use CI reference column list. If only one\n option is available, it is automatically selected.
    • Configure the pattern between an application service node set with the\n Convert attached nodes to pattern option, and\n a non-CMDB table node: Select Apply <table> reference\n filter to all nodes in the pattern to apply the query to\n the application service CI itself and to the CIs within the application\n service.
    • Add filters to a class node: Apply filters to narrow down a class query\n to a specific set of CIs or to a single specific CI.
      1. Point to the node to add a filter to, and then click the\n Apply filters icon that pops up\n above the node.
      2. In the Filters section, add attribute and related list conditions.
      3. Close the Filters section.

      \nFor example: Add a filter for database location to query for\n databases located in Seattle.

      \n\n

      Click Applied\n Filters in the right-side bar to view all filters\n for each node on the canvas.

      \n
    • Add And/Or operators to the query:
      1. Connect one node to two other nodes.
      2. Click the And box that appears on the\n connection line, to toggle between the\n And/Or\n operators.

      \nFor example: C1 is Tomcat WAR, C2 is Linux Server, and C3 is\n Windows Server. Query for All Tomcat WAR CIs which are\n connected either to Linux Server Or to a Windows\n Server.

      \n
    • Add property columns for a node, to appear in the query\n results:

      Note: For a relationship, the query results include the\n parent, child, and\n type columns. You cannot add any other\n columns from the [cmdb_rel_ci]\n table.

      \n\n
      1. Click Properties in the right-side\n pane.
      2. Click a node once or twice, so that the Report Columns section\n appears in the right-side bar, and then click Add\n Columns.
      3. Select properties and then click outside the properties list to\n close it.
      \n
    • Create a combination query by integrating a Service Mapping\n query into a CMDB query:
      1. When building a CMDB query, click Saved Service\n Queries in the left-side bar.
      2. Select and then drag a Service Mapping query to the canvas.

      \nThis query returns all CIs that satisfy the CMDB query, and\n that are included in the services returned by the embedded Service Mapping\n query.

      \n
    • Add a search tag that can then be used as a search criteria for saved\n queries:
      1. Click the Add Tags icon at the top of the\n canvas.
      2. Click Add Tag and in the Query\n Tags dialog box enter one or more tag\n strings.
      3. Click the Add Tags icon again to close\n the Query Tags dialog box.
      \n

    \n\n

    \n
  4. \n Click Save.\n

    \n

    On the Saved Queries tab, point to a saved query\n widget and click Query Information. Query details\n such as the query type, last update date, CMDB groups associated with the\n query, and the query schedules appear.

    \n\n

    \n

\n\n

\n

  • Click Run.

    \n\n

    Only the first 100 results of the query appear in the results pane.

    • Click Load More Results to view the next set\n of 100 results.
    • Click Load All Results to view the rest of\n the query results, up to the number specified by the glide.cmdb.query.max_results_limit system property\n (10,000 by default).

    \n

    \n\n

    Click a CI to open its CI form, and on the CI form click\n Dashboard to view CI health in the CI\n dashboard.

    \n\n

    Note:

    • Ensure that the glide.security.use_csrf_token\n property is set to true, allowing all results to appear.
    • When Level is set to Up to 2nd\n level relationships, the relationship type does not\n appear in the query results.
    • When a query is running, wait for it to complete or to time out\n before opening or running another query.

    \n

    \n
  • Modify Query Builder\n settings: Click the Build a CMDB query using the CMDB Query Builder - Product Documentation: Utah (1) (Settings) icon to open the Query\n Builder Settings dialog box.
  • Copy and share the URL of a saved query with users that have access to the CMDB\n Query Builder. Pasting the shared URL in a new internet browser window, directly\n opens the saved query in the CMDB Query Builder.
  • Create reports in CMDB Query Builder.
  • Create a schedule to run the\n query at a future time, and to email the results to interested parties.
  • Export query results:

    Click the Query Results context menu and select\n Export. Even if the Load More\n Results button is visible, indicating that there are\n additional query results, only the results that are visible are\n exported.

    \n
  • Export and import a CMDB query to port a query definition between\n instances.
  • Populate a CMDB group\n using a saved query.
  • Delete a CMDB query.

\n\n

\n\n

Build a CMDB query using the CMDB Query Builder - Product Documentation: Utah (2024)
Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 5960

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.