# Alert on Host availability - host state isn't changing

**URL:** <https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603>\
**Category:** Alerting\
**Tags:** problem-detection, davis\
**Created:** [July 22, 2025, 10:49pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603 "2025-07-22T22:49:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://community.dynatrace.com/u/Troy)\
**Post date:** [July 22, 2025, 10:49pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/1 "2025-07-22T22:49:01Z")

</div>

Hello,

Im trying to create an alert based on a hosts availability.state not being “up”.  
the issue is when i turn off oneagent - it doesnt always set the state to “unmonitored\_agent\_stopped” it will just leave gaps as shown. so my alert does not always work.

 ![troymaxwell_0-1753224340524.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/e/fe4e077e420ed1c208171f2bfc1f38307ce53de9.png)

We want to be able to alert on agent being turned off / host being offline and customize the alert which is why we are not using the OOTB option.

DQL I tried using David Anomaly Detection:

```c
timeseries availability = sum(dt.host.availability),
    nonempty:true,
    filter:{availability.state != "up" },
    by:{dt.entity.host, availability.state}

```

---

<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:** [July 23, 2025, 12:33am UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/2 "2025-07-23T00:33:16Z")

</div>

[@Troy](https://community.dynatrace.com/user/92499)&nbsp;If your intention is to trigger an alert whenever the availability state != up, you can use the timeseries command with the nonempty parameter to calculate host availability. This parameter ensures that you get a result even when no data match the filter, such as when no hosts are up

[https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/commands/metr…](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/commands/metric-commands?_gl=1*187rd8r*_ga*MTIzMDk2MzAwOS4xNzQzNjU5MDk4*_ga_1MEMV02JXV*czE3NTMyMjU3MzUkbzQzMyRnMSR0MTc1MzIyOTk0OSRqNjAkbDAkaDA.#expand--nonempty-parameter--1)

Here is an example you can refer

> **[DQL timeseries examples for Metrics](https://docs.dynatrace.com/docs/analyze-explore-automate/metrics/dql-examples)**
>
> DQL timeseries examples

```markup
timeseries Availability = sum(dt.host.availability, default:0),
    nonempty:true,
    by:{dt.entity.host},
    filter:{availability.state == "up"}
    //| filter dt.entity.host == "HOST-XXXX"

```

You need to use a threshold to alert if less than 1 and that should do the trick

 ![p_devulapalli_0-1753230522519.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/9/99b1c6923a0a15fffe79812937ad82f0963e0b21.png)

 ![p_devulapalli_1-1753230666915.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/2/128f469173384c4278fda70041c50e944a1846eb.png)

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://community.dynatrace.com/u/Troy)\
**Post date:** [July 23, 2025, 12:30pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/3 "2025-07-23T12:30:50Z")

</div>

Ah! I was close - thank you this seems to be working.

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://community.dynatrace.com/u/Troy)\
**Post date:** [July 23, 2025, 3:11pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/4 "2025-07-23T15:11:41Z")

</div>

[@p\_devulapalli](https://community.dynatrace.com/user/21657)&nbsp;So this works to a degree - im seeing the alert come in but it will close the problem after some time even though the value is still 0 / agent is still down. any idea how i can fix this?

---

<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:** [July 24, 2025, 10:09am UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/5 "2025-07-24T10:09:25Z")

</div>

[@Troy](https://community.dynatrace.com/user/92499)&nbsp;That should not be happening , the problem should not be closing unless there is a change in threshold . Do you still see this happening ?

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://community.dynatrace.com/u/Troy)\
**Post date:** [July 24, 2025, 2:57pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/6 "2025-07-24T14:57:30Z")

</div>

Hello - Yes I see this happening, the problem gets created and stays open for a few minutes and closes on its own, the alerting is set to 3 ,5, 5 which is the default values. the problem closes even though the agent is still down and value is 0 for availability.

---

<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:** [July 25, 2025, 4:41am UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/7 "2025-07-25T04:41:50Z")

</div>

[@Troy](https://community.dynatrace.com/user/92499)&nbsp;That’s bit odd , did you add any dimensions that change over time to the anomaly detector event name or description?

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://community.dynatrace.com/u/Troy)\
**Post date:** [July 25, 2025, 3:37pm UTC](https://community.dynatrace.com/t/alert-on-host-availability-host-state-isnt-changing/52603/8 "2025-07-25T15:37:00Z")

</div>

Nope - My detector is essentially the same as yours except it is filtering for on Os instead of a single machine. may open a case with Dynatrace if this behaviour is not expected.
