# Dashboard tile with number of hosts with CPU bigger than 80%?

**URL:** <https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517>\
**Category:** Dashboarding\
**Tags:** dashboards-classic\
**Created:** [October 23, 2024, 11:51pm UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517 "2024-10-23T23:51:30Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 23, 2024, 11:51pm UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/1 "2024-10-23T23:51:30Z")

</div>

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:

```markup
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…

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [October 24, 2024, 3:11am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/2 "2024-10-24T03:11:17Z")

</div>

Hi&nbsp;[@AntonioSousa](https://community.dynatrace.com/user/17213)&nbsp;, how about using the table and pin it to dashboard ?

 ![p_devulapalli_0-1729739424192.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/635a526e97a9ff4aedf02e55bfe56c28b05ef068.png)

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 6:40am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/3 "2024-10-24T06:40:44Z")

</div>

I’m afraid it’s not possible, i was trying hard with similar task.

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 6:43am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/4 "2024-10-24T06:43:23Z")

</div>

In fact table in data explorer is only way to really count records, but unfortunately, when pinned to dashboard that count is not displayed.

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [October 24, 2024, 7:24am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/5 "2024-10-24T07:24:31Z")

</div>

[@AntonioSousa](https://community.dynatrace.com/user/17213)&nbsp;what about this?

```markup
builtin:host.cpu.usage:splitBy("dt.entity.host"):filter(series(avg,gt(10))):count:splitby():last

```

 ![Julius_Loman_0-1729754607347.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/3163c65b0049ea001f3e88d10bde4072f8ec5596.png)

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 7:53am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/6 "2024-10-24T07:53:33Z")

</div>

It’s not working - f.e. 5 hosts with cpu\>0

 ![rastislav_danis_0-1729756165473.png](https://global.discourse-cdn.com/dynatrace/original/3X/7/e/7ecd7494cfc9ed9971fa232f979cae3ff6a0b04e.png)

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 24, 2024, 7:56am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/7 "2024-10-24T07:56:42Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364)

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:

```markup
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!

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 8:06am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/8 "2024-10-24T08:06:09Z")

</div>

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)

 ![rastislav_danis_0-1729757162423.png](https://global.discourse-cdn.com/dynatrace/original/2X/e/ee6bb5c48a82b553b5f33683d7af1e103ea7881d.png)

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 8:10am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/9 "2024-10-24T08:10:27Z")

</div>

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():

 ![rastislav_danis_1-1729757382321.png](https://global.discourse-cdn.com/dynatrace/original/2X/9/98cf5b689eff8a733ef6a156be89d9cd65784ebf.png)

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 8:17am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/10 "2024-10-24T08:17:41Z")

</div>

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:

 ![rastislav_danis_0-1729757843369.png](https://global.discourse-cdn.com/dynatrace/original/3X/8/0/809e36c5ccceb84cd72cf2bd0ca981d30c48ff2e.png)

---

<div class="post-metadata">

**Author:** ![PedroDeodato](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pedrodeodato/32/32284_2.png) [@PedroDeodato](https://community.dynatrace.com/u/PedroDeodato)\
**Post date:** [October 24, 2024, 10:29am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/11 "2024-10-24T10:29:11Z")

</div>

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:

```markup
builtin:host.cpu.usage:filter(series(avg,gt(80))):splitBy():count

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 24, 2024, 10:59am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/12 "2024-10-24T10:59:31Z")

</div>

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](https://community.dynatrace.com/user/40725) metric selector is the most efficient, but does anyone have any idea which metric selectors are more efficient or not?

---

<div class="post-metadata">

**Author:** ![rastislav\_danis](https://avatars.discourse-cdn.com/v4/letter/r/b9bd4f/32.png) [@rastislav\_danis](https://community.dynatrace.com/u/rastislav_danis)\
**Post date:** [October 24, 2024, 11:04am UTC](https://community.dynatrace.com/t/dashboard-tile-with-number-of-hosts-with-cpu-bigger-than-80/48517/13 "2024-10-24T11:04:58Z")

</div>

It was very useful for me as well, thanks for posting question! [@PedroDeodato](https://community.dynatrace.com/user/40725) 's selector is ok, but you have to also check Fold transformation (for Single value visualization) to be in correct mode (Auto or Maximum).
