The feature Browse objects in Cloudaware CMDB allows writing a query for objects and related fields of different levels to be displayed in a list view builder. Use Query Mode for the advanced view.
Select the resource type (e.g. AWS EC2 Instances) in CMDB Navigator:
Click Browse Objects on the left. Select Query Mode to start working on a query.
A query may include such components as condition expressions (filters), field labels and logical operators:
`Deleted From AWS` equals null and `CloudWatch: CPU, 60-Day` > 20 -> `Account`.`Account Name`, `Instance Name or ID`, `CloudWatch: CPU, 60-Day` DESC
In this example, we use the condition `Deleted From AWS` equals null to view all assets that are currently present in the cloud. You can write a query without conditions, type the fields one by one using a comma. The `Account`.`Account Name` is used to specify the object field Account from which the related field Account Name will be retrieved.
This is an example of EC2 Instances object query. A query may consist of different components depending on an object.
To search for an object and/or its related field, use:
Field API Name
Field label (should be typed in ``)
Put a dot after the object field name to select a related field from the drop-down list as below:
When trying to filter by lookup, use the path to the field which you filter by. For example, if you type Account = “abc” , it will turn back account ID not name, what results in an error in filtering. Type Account.Name = “abc” instead.
Cloudaware filters the fields containing JSON data by the values in their JSON fields. Type a JSONPath expression starting with $ and use the dot- or the bracket-notation. The structure of your query with JSONPath should be the following:
$.FieldName support numbers, letters and underscore only, e.g. $.abc_22. In cases you need to use other characters, refer to the format $["abc-22"].
Example: The filter `Tags JSON`[$.Name] equals "test" compares the value of the field 'Name' in the object 'Tags JSON' to the value 'test'.
You can type the number of the array's element or use wildcard symbol * to refer to all elements:
Example: `FieldName`[$["Field with whitespaces"][*]]
If you make a filter-only search, the columns of a list with results will be arranged automatically according to the order inherited from the object field. The default related fields are Name, or Title, or Subject, or ID.
The search may bring back empty results, so only the column with no data will be shown in the list.
Use the following logical operators to filter out the data your query returns:
Use for an exact match
Use for an exact match with a certain value excluded
Use when you want results that exceed the value you enter
Use for results that match or exceed the value you enter
Use for results that are less than the value you enter
Use for results that match or are less than the value you entered
Use for fields that include your search string
Use to eliminate records that don’t contain the value you enter
Use with % sign to locate records that include any part of the value you enter, e.g:`Account`.`Account Name` like "%test" or `Account`.`Account Name` like "%str%"
Use with % sign to locate records that exclude any part of the value you enter, e.g:`Instance Name or ID` notLike "%environment" or `Instance Name or ID` notLike "%environ%"
Use for results that start with a certain value, e.g: `Instance Name or ID` startsWith "a"
AND and OR operators are used for evaluating conditions you set up for your search.
Logic values STRING, BOOLEAN, Date, DateTime, Time, Number, etc. are required when a condition is used for filtering:
Example: `Breeze Is Active` = TRUE
Pay attention to the data format, it should be the following:
Use a constant* from the drop-down list or type the date in the format YYYY-MM-DD
Use a constant* from the drop-down list or type the date in the format YYYY-MM-DDThh:mm:ss[.sss][Z]
Use a constant* from the drop-down list or type the date in the format hh:mm:ss[.sss][Z]
* List of Date and DateTime constants is available here.
[.sss] - milliseconds, [Z] - timezone are optional.
`Deleted From AWS` equals 2018-08-08T12:00:00 `Created Date` equals THIS_YEAR `Created Date` equals LAST_N_DAYS:90
You can type a certain value of N using : sign and a number.
You can set up a custom label for a column in the list with results using as after a field name (label) as shown below:
`Account`.`Owner ID`.`Name` as "Account Owner Name
You can extract more data from elements of JSON in the columns containing JSON data. Type a JSONPath expression* in the following way: [$.FieldName.FieldName2]
The column Tags JSON`[$.Name] will contain values of the field 'Name'.
The column Policy Document JSON`[$.Statement] will contain values of the first (0) element of the field array 'Statement'.
The column Policy Document JSON`[$.Statement[*].Sid] will contain values of the field 'Sid' of all elements in the field array 'Statement'.
To set up columns sorted in a specific order, use the separator -> after the condition section in your query and type the fields names (labels) using a comma.
`Deleted from AWS` equals null and `State Name` equals "running" -> `Account`, `Instance Name or ID`, `Breeze: Last Update`, `Breeze: Upgradable Packages, Optional`, `Breeze: Upgradable Packages, Security`
You can also sort the data in a column by order typing ASC (ascending) or DESC (descending) after a field name.
Pre-validation allows you to enable a correct query with no errors from back-end received. The green tick indicates that everything is ok.
In case a query is incomplete or contains incorrect parameters, hover to red X to get a tip on how the query can be improved: