24 Oct 2024 12:51 AM
In Data Explorer, if you want to have a list of hosts that have, eg. more than 80% of CPU for a certain timeframe, you put the following metric selector and select table:
builtin:host.cpu.usage:splitBy("dt.entity.host"):filter(series(avg,gt(80)))
Now imagine there are 10 hosts in the list and you want a single value in a dashboard with 10 in it. Been struggling to get this use-case done 🤣 Any ideas?
And yes, it's for a Managed environment...
Solved! Go to Solution.
24 Oct 2024 07:43 AM
In fact table in data explorer is only way to really count records, but unfortunately, when pinned to dashboard that count is not displayed.
24 Oct 2024 07:40 AM
I'm afraid it's not possible, i was trying hard with similar task.
24 Oct 2024 08:24 AM
@AntonioSousa what about this?
builtin:host.cpu.usage:splitBy("dt.entity.host"):filter(series(avg,gt(10))):count:splitby():last
24 Oct 2024 08:53 AM
It's not working - f.e. 5 hosts with cpu>0
24 Oct 2024 08:56 AM
I tried your selector and it was very volatile. It would sometimes work, but others not.
But I have worked with it, and came to this one, only without the last:
builtin:host.cpu.usage:splitBy("dt.entity.host"):filter(series(avg,gt(80))):count:splitby()
This one seems to work perfectly!
Thanks for the double splitBy() idea!
24 Oct 2024 11:29 AM
If you skip the first splitBy() transformation, the expression can be simplified a bit and it still works.
The only requirement is that you apply the second splitBy() (in my case, the only one) before you apply the :count transformation, otherwise it won't work.
As a result, I got this:
builtin:host.cpu.usage:filter(series(avg,gt(80))):splitBy():count
Hope this helps!
24 Oct 2024 09:06 AM
I found out that you have to timeshift and then it's finally working:
builtin:host.cpu.usage:splitBy("dt.entity.host"):filter(series(avg,gt(0))):count:splitby():timeshift(-1m)
24 Oct 2024 09:10 AM
it's b/c data from all records are not collected in last time bucket, for other metrics collected with >1m interval you will need to perform bigger timeshift. Here is examle of what you can get if doing last():
24 Oct 2024 09:17 AM - edited 24 Oct 2024 11:54 AM
simple skipping :last() without timeshift() will also work for single value, but you need to let "Auto" or "Maximum" Fold transformation with global timeframe >1m:
24 Oct 2024 11:59 AM - edited 24 Oct 2024 12:22 PM
Thanks all for your input! Several ways to do something that I believe is a good use-case 🤗
Which leaves me thinking that the efficiency of doing certain approaches in Data Explorer might lead to different usage of resources inside the Dynatrace platform.
Looks like @PedroDeodato metric selector is the most efficient, but does anyone have any idea which metric selectors are more efficient or not?
24 Oct 2024 12:04 PM
It was very useful for me as well, thanks for posting question! @PedroDeodato 's selector is ok, but you have to also check Fold transformation (for Single value visualization) to be in correct mode (Auto or Maximum).