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

DQL - Metric in dashboard to host

Fast
Newcomer

Hi there.

I am new in DQL, and I need help to have and view metrics (CPU usage by host / Memory usage by host) in the dashboard, those hosts have an specific tag.

Therefore, I have been trying to get the metrics since days ago; however, I have not been able to do it. I was wondering if you know how to segment this by the tag and bring the metric.

I was checking many cases in Dynatrace Community and I tried those queries, and the queries work, but they mix the host.

Grateful if anyone can help on the this issue.

Thanks!

 

3 REPLIES 3

p_devulapalli
Champion

@Fast Please try similar to below

p_devulapalli_0-1739234679692.png

 

Phani Devulapalli

zaid-bashir
Advisor

Hi @Fast 
I am posting  here a similar solution but by searching hostname, you can find the query below.

timeseries {avgCpu = avg(dt.host.cpu.usage),avgMem = avg(dt.host.memory.usage)}, by:{dt.entity.host}, interval:30m
| fieldsRename id = dt.entity.host 
| join [fetch dt.entity.host | fieldsAdd entity.name],on: {id}
| filter right.entity.name == $Search_Host

zaidbashir_0-1739255425522.png

But You have to first create a variable for Search_Host which will take your hostname and checks the hostname that is equal to resulted hostname and filters the result. You can also use contains() here to get the results matching with Search_Host Variable.

You can modify the above query to get remaining metrics and add other variables to furthur extend the query.

If you need furthur help in this, reply.


Just wanted to add on here another way to get entity names as a tip!

timeseries {avgCpu = avg(dt.host.cpu.usage),avgMem = avg(dt.host.memory.usage)}, by:{dt.entity.host}, interval:30m
| fieldsAdd entity.name = entityName(dt.entity.host)
| filter entity.name == $Search_Host

You can also use the entityAttr() to get a specific attribute removing the need to write out and do a full join/lookup and then cleanup any of the stuff that comes with that.

Featured Posts