02 Oct 2024 12:47 PM - last edited on 03 Oct 2024 07:31 AM by MaciejNeumann
Hello everyone,
I am new to the DQL language and I would like to ask if it is possible to make a CPU comparison with the average of all hosts entities that are included by several tags.
Let me explain, I have this query that gives me the average CPU usage of all the hosts that match the filter tags:
timeseries usage = avg(dt.host.cpu.usage),
filter: { in(dt.entity.host, classicEntitySelector(“type(host),tag(\”APP:FAKE_APP")}
On the other hand I have this other query that compares me the CPU consumption of the hosts that match the host.name:
timeseries cpu=avg(dt.host.cpu.usage),
by:{host.name},
from: -30d
| append [timeseries cpu.30d=avg(dt.host.cpu.usage), by:{host.name}, shift:-30d]
| filter startsWith(host.name, “FAKE_HOST”).
My question is if they can be somehow linked so that the filter uses custom tags instead of host.name.
Thank you very much
03 Oct 2024 03:39 PM
I am not sure if i captured the need correctly, but here is my example: comparison of individual host CPU usage (only hosts with given tags) and average CPU usage of all hosts for earlier period of time.
timeseries avg(dt.host.cpu.usage), by: {dt.entity.host}, filter:{ in(dt.entity.host, classicEntitySelector("type(host),tag(Azure:VM)")) }
| append [
timeseries avg(dt.host.cpu.usage), shift: -7d
, filter:{ in(dt.entity.host, classicEntitySelector("type(host),tag(Azure:VM)")) }
| fieldsAdd dt.entity.host = "Reference"
]
Result looks like this: