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

IngestMetric affect on a entities by different way of dt.entity.host

Stef_Stouf95
Participant

Hi

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 (dt.entity.host=HOST-XXXXXXXXXX) like that :
custom.mymetric,dt.entity.host=HOST-XXXXXXXXX1,hostname=host1 100
custom.mymetric,dt.entity.host=HOST-XXXXXXXXX2,hostname=host2 37
custom.mymetric,dt.entity.host=HOST-XXXXXXXXX3,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,dt.entity.host=host1,hostname=host1 100
custom.mymetric,dt.entity.displayname=host1,hostname=host1 100

Thanks

3 REPLIES 3

Mike_L
Dynatrace Guru
Dynatrace Guru

Hi,

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

https://www.dynatrace.com/support/help/how-to-use-dynatrace/metrics/metric-ingestion/ingestion-metho...

Mike

Mike

Stef_Stouf95
Participant

 

Hi Mike, thanks for your answer.

 

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

 

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 dt.entity.host 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

Thx

@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