# How to generate alert for specific host name

**URL:** <https://discuss.elastic.co/t/how-to-generate-alert-for-specific-host-name/186252>\
**Category:** Kibana\
**Created:** [June 18, 2019, 12:30pm UTC](https://discuss.elastic.co/t/how-to-generate-alert-for-specific-host-name/186252 "2019-06-18T12:30:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![swapnali](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@swapnali](https://discuss.elastic.co/u/swapnali)\
**Post date:** [June 18, 2019, 12:30pm UTC](https://discuss.elastic.co/t/how-to-generate-alert-for-specific-host-name/186252/1 "2019-06-18T12:30:03Z")

</div>

```
Hi,

I want to set a trigger when cpu usage reached more than 90% on beat.hostname is elsearchdv1

below are my watcher.json

{
  "trigger": {
    "schedule": {
      "interval": "1s"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "metricbeat-*"
        ],
        "types": [],
        "body": {
          "query": {
              
            "match": {
              "beat.hostname": "elsearchdv1"
            },
            "range": {
              "system.cpu.user.pct": {
                "gt": "0.90"
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.hits.total": {
        "gte": 1
      }
    }
  },
  "actions": {
    "send_email": {
      "email": {
        "profile": "standard",
        "to": [
          "xxx@yyy.com"
        ],
        "subject": "Watcher Notification",
        "body": {
          "text": "CPU Threshold for {{ctx.payload.hits.hits.0._source.host}} exceeded"
        }
      }
    }
  }
}

its not generating an alert please help me in this.
```

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [June 21, 2019, 9:37am UTC](https://discuss.elastic.co/t/how-to-generate-alert-for-specific-host-name/186252/2 "2019-06-21T09:37:37Z")

</div>

You should use the Threshold alert builder for this. It's in the UI in Kibana, next to the Advanced watch.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 19, 2019, 9:37am UTC](https://discuss.elastic.co/t/how-to-generate-alert-for-specific-host-name/186252/3 "2019-07-19T09:37:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
