17 Apr 2024 11:32 PM - last edited on 18 Apr 2024 08:14 AM by MaciejNeumann
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
Solved! Go to Solution.
18 Apr 2024 05:24 PM
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:
Kris
24 Apr 2024 05:17 PM
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
Soport
24 Apr 2024 05:30 PM
My screenshot was take in Notebooks app where you can click on "complex record" and see what is inside (show link to menu):
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
09 Oct 2024 05:54 AM
Hi,
Is it possible to run a DQL that displays the incoming or outgoing services or entities related to a service?