cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Querying services related to an entity

soportetr
Guide

Hi everyone,

 

A customer has requested a particular functionality: to display in a table the list of services associated with a specific entity (hosts, processes, etc.).

I would like to know if it is possible to perform this task using DQL language. I would appreciate any guidance or examples that you can provide me in this regard.

 

Thanks in advance

 

3 REPLIES 3

krzysztof_hoja
Dynatrace Advisor
Dynatrace Advisor

You can use DQL native syntax:

fetch dt.entity.service
| filter matchesValue(runs_on[dt.entity.process_group],"PROCESS_GROUP-140E7EA6D10A29E1")

But such queries can be slow until entites are stored in Grail too.

For now we recommend using classicEntitySelector function (where syntax of the filter should be known from classic Data Explorer which is BTW good place to test such expressions). Same result can be achieved this way:

fetch dt.entity.service
| filter in(id, classicEntitySelector("type(service),fromRelationship.runsOn(type(PROCESS_GROUP),entityId(\"PROCESS_GROUP-140E7EA6D10A29E1\"))"))

 

You can explore relationship of specific service from its perspective:

fetch dt.entity.service
| filter id=="SERVICE-086610B2358E4225"
| fieldsAdd runs_on

Then you get run_on showing all entities service runs on:

krzysztof_hoja_0-1713457429429.png

 

Kris

Hi,

I managed to execute the query, however, a complex record appears and I don't get the results as you do. I share with you the following screenshot

query-related-service.png

 

Soport

My screenshot was take in Notebooks app where you can click on "complex record" and see what is inside (show link to menu):

krzysztof_hoja_0-1713975938504.png

I checked and Dashboard app does not have such functionality.

But when you know how fields are named in complex record, you can always extract them from it this way:

| fieldsAdd runs_on[dt.entity.host]

Result in Dashboards looks like this 

krzysztof_hoja_1-1713976104077.png

 

 

Featured Posts