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

IngestMetric affect on a entities by different way of



use case :

i have an server (host0) with a oneagent, i have a script on it to retrieve different metrics of other servers, and push it
custom.mymetric,hostname=host1 100
custom.mymetric,hostname=host2 37
custom.mymetric,hostname=host3 13

i can affect the metric on an entity if i use the DT unique key ( like that :
custom.mymetric,,hostname=host1 100
custom.mymetric,,hostname=host2 37
custom.mymetric,,hostname=host3 13

but on the server (host0) this unique key is unknown (i can do a call api on master to retrieve but it's not acceptable on a script launched each 1 minute to retrieve id of X servers)

exist it a method ?


i test that without success :
custom.mymetric,,hostname=host1 100
custom.mymetric,dt.entity.displayname=host1,hostname=host1 100



Dynatrace Guru
Dynatrace Guru


If you use the local ingest on the OneAgent the host entity id is added automatically:





Hi Mike, thanks for your answer.


indeed it's work on my example : custom.mymetric,,hostname=host3 13
if i execute on the server it take the server context and affect on it without put in


but my case is, the api call is done on another server (for exemple a cluster or a silo) that retrieve metrics of lot of servers.
the only information known is the hostnames not applicable on field,
i can do before an api call (/api/v2/entities?pageSize=50&entitySelector=type("host"),entityName.startsWith("host1")), and retrieve this id in payload "entities.entityId"
but the process is heavier


@Stef_Stouf95  yes, you need to specify the entity id, in this case the host id. The host id will never change unless you change the hostgroup and then it's in fact a new host. 

Depending on your script and use case you can either configure it statically in a map in your script or do a lookup on the script startup and then cache the values as required.

Certified Dynatrace Master | Alanata a.s., Slovakia, Dynatrace Master Partner

Featured Posts