22 Dec 2024 02:43 PM
I'm trying to create a timeseries tile that presents a Process Memory /CPU usage per host, and filter it according to a variable called "ServiceId". for example :
I use a variable called "ServiceID" and i choose "Service-123". I want to receive a tile for the CPU and another one for memory usage of the Service's process, spited by the hosts it is running on. so if it runs on server A and Server B i will get a tile with 2 graphs showing the memory usage of the service's process (same for CPU).
i tried to create several DQL for that but couldn't get to a correct one. i'll be glad for advise and code examples.
Thanks!
Solved! Go to Solution.
23 Dec 2024 07:37 AM
Try this:
timeseries avg(dt.process.cpu.usage), by: { dt.entity.process_group_instance, dt.entity.process_group, dt.entity.host }
| fieldsAdd dt.entity.process_group_instance.name = entityName(dt.entity.process_group_instance)
| fieldsAdd dt.entity.process_group.name = entityName(dt.entity.process_group)
| fieldsAdd dt.entity.host.name = entityName(dt.entity.host)
| fieldsAdd value.A = arrayAvg(`avg(dt.process.cpu.usage)`)
| lookup [ fetch dt.entity.service
| fields entity.name, id, runs_on
| fieldsFlatten runs_on
], sourceField:dt.entity.process_group, lookupField:runs_on.dt.entity.process_group
| filter lookup.entity.name == $Service
Variable Service
fetch dt.entity.service
| fields entity.name
23 Dec 2024 01:11 PM
Thanks that helps!
Any chance to get the legend as the process name and the host name? currently it's the process name and the host id
23 Dec 2024 01:34 PM
You can update that in the Legend and tooltip section under Visual: