# Need to get website hosted on a server as watcher result

**URL:** <https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [August 23, 2018, 2:55pm UTC](https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764 "2018-08-23T14:55:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![max17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max17/32/42694_2.png) [@max17](https://discuss.elastic.co/u/max17)\
**Post date:** [August 23, 2018, 2:55pm UTC](https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764/1 "2018-08-23T14:55:29Z")

</div>

Hi, I have 3 websites hosted on my server, my query is , is there any way to get website name when watcher execute. Now I am getting hostname in subject line.  
{  
"trigger": {  
"schedule": {  
"interval": "10s"  
}  
},  
"input": {  
"search": {  
"request": {  
"search\_type": "query\_then\_fetch",  
"indices": [  
"heartbeat-xyz-\*"  
],  
"types": [],  
"body": {  
"size": 0,  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"monitor.status": {  
"value": "down"  
}  
}  
}  
],  
"filter": [  
{  
"range": {  
"@timestamp": {  
"from": "now-10s"  
}  
}  
}  
]  
}  
},  
"aggregations": {  
"by\_monitors": {  
"terms": {  
"field": "beat.hostname",  
"size": 100,  
"min\_doc\_count": 1  
}  
}  
}  
}  
}  
}  
},  
"condition": {  
"compare": {  
"ctx.payload.hits.total": {  
"gt": 0  
}  
}  
},  
"actions": {  
"email\_1": {  
"email": {  
"account": "gmail\_account",  
"profile": "gmail",  
"to": [  
"xyz@gmail.com"  
],  
"subject": "Alert! SERVER IS DOWN !!",  
"body": {  
"html": "{{ctx.payload.hits.total}} Server has stopped working:

{{#ctx.payload.aggregations.by\_monitors.buckets}}{{key}}  
{{/ctx.payload.aggregations.by\_monitors.buckets}} \t \n\n at times: {{ctx.trigger.triggered\_time}} \n\n"  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 31, 2018, 9:13am UTC](https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764/2 "2018-08-31T09:13:42Z")

</div>

Hey,

have you taken a look at the metricbeat data, when configured a HTTP check? As you do configure url to connect to, you implicitely configure different websites. Check the `http.url` field of those documents.

--Alex

---

<div class="post-metadata">

**Author:** ![max17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/max17/32/42694_2.png) [@max17](https://discuss.elastic.co/u/max17)\
**Post date:** [September 7, 2018, 2:37pm UTC](https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764/3 "2018-09-07T14:37:11Z")

</div>

hi, I got the solution. Just need to add "Monitor.ID" in term field. It is now showing me the website name which is down.

---

<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:** [October 5, 2018, 2:37pm UTC](https://discuss.elastic.co/t/need-to-get-website-hosted-on-a-server-as-watcher-result/145764/4 "2018-10-05T14:37:18Z")

</div>

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