03 Jul 2024 04:30 PM - last edited on 04 Jul 2024 09:34 AM by MaciejNeumann
Is anyone aware of a DQL statement or notebook that can be formulated to dynamically give the friendly name of entities based off relationships?
For Example HostIDXXXXXX to/from relationships in the api we get the Dynatrace IDs. In the past we had to create an api that would take the result of the Host ID GET then submit multiple gets for the relationship items that were formulated from the first GET, just to get the friendly name.
Solved! Go to Solution.
03 Jul 2024 08:35 PM
Hey @ChadTurner ,
Not sure about the Host to process correlation but host to host can be done there are two fields in dql that you can use to filter when you do "fetch dt.entity.host" they are calls and called_by which are pretty much self-explanatory.
calls: The target hosts which our host is calling.
called_by: The hosts to which our host is the target host.
So here's the dql.
fetch dt.entity.host
| filter entity.detected_name == <Host's friendly name here>
| fields called_by
| expand called_by[dt.entity.host]
| lookup sourceField:`called_by[dt.entity.host]`, lookupField:id,[fetch dt.entity.host | fieldsAdd id]
maybe you can edit this and add calls and called_by in the same query but yeah this is pretty much it.
Hope this helps.
Regards,
@Maheedhar_T
04 Jul 2024 05:16 PM
If I understand correctly, this could be a solution:
fetch dt.entity.host
| filter id == "HOST-6C867CD1BF3229B0"
| fieldsAdd dt.entity.process_group=runs[dt.entity.process_group]
| expand dt.entity.process_group
| fields dt.entity.process_group, dt.entity.process_group.name = entityName(dt.entity.process_group)
First get process groups entity IDs running on host and next lookup for their names. Result looks like this:
I used works "lookup" on purpose, because entityName (and similar entityAttr) function is easy to use wrapper of for lookup command where you can get many more entity properties in one step:
fetch dt.entity.host
| filter id == "HOST-6C867CD1BF3229B0"
| fieldsAdd dt.entity.process_group=runs[dt.entity.process_group]
| expand dt.entity.process_group
| lookup [
fetch dt.entity.process_group
], sourceField:dt.entity.process_group, lookupField:id, executionOrder:leftFirst,
fields:{process_group.name=entity.name, process_group.softwareTechnologies=softwareTechnologies}
| fields dt.entity.process_group, process_group.name, process_group.softwareTechnologies
Kris
08 Jul 2024 02:46 PM - edited 08 Jul 2024 02:47 PM
Thank you all for your help on this!