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

Using DQL or notebooks to pull the friendly name of relationships?

ChadTurner
DynaMight Legend
DynaMight Legend

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. 

ChadTurner_0-1720020592694.png

 

-Chad
3 REPLIES 3

Maheedhar_T
Advisor

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 

Maheedhar

krzysztof_hoja
Dynatrace Champion
Dynatrace Champion

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: 

krzysztof_hoja_0-1720109270777.png

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

krzysztof_hoja_1-1720109700514.png

Kris

 

ChadTurner
DynaMight Legend
DynaMight Legend

Thank you all for your help on this! 

 

-Chad

Featured Posts