Nagios - HTTP GET
Posted: Sun May 06, 2018 11:56 pm
Hi,
I'm trying to think of way to query ElasticSeach with HTTP GET. this is my query:
GET /test-log-YYYY.MM.DD/_count HTTP/1.1
Host: test.kibana.com:9200
User-Agent: curl/7.58.0
Accept: */*
Content-Length: 132
Content-Type: application/x-www-form-urlencoded
{ "query": { "bool": { "must": [{ "match_phrase": { "message": "time out" }}, { "range": { "date": { "gte": "now-15m" } } } ] } } }
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 59
{"count":0,"_shards":{"total":5,"successful":5,"failed":0}}
where YYYY.MM.DD is the current date, Then it should raise alarm in case the returned count value is greater than zero, and remove alarm if it returns to zero.
It should query ElasticSearch index called test-log-YYYY.MM.DD for all events added during last 15 minutes and containing text “time out”.
How i can implement such query on Nagios?
Thanks,
Amit
I'm trying to think of way to query ElasticSeach with HTTP GET. this is my query:
GET /test-log-YYYY.MM.DD/_count HTTP/1.1
Host: test.kibana.com:9200
User-Agent: curl/7.58.0
Accept: */*
Content-Length: 132
Content-Type: application/x-www-form-urlencoded
{ "query": { "bool": { "must": [{ "match_phrase": { "message": "time out" }}, { "range": { "date": { "gte": "now-15m" } } } ] } } }
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 59
{"count":0,"_shards":{"total":5,"successful":5,"failed":0}}
where YYYY.MM.DD is the current date, Then it should raise alarm in case the returned count value is greater than zero, and remove alarm if it returns to zero.
It should query ElasticSearch index called test-log-YYYY.MM.DD for all events added during last 15 minutes and containing text “time out”.
How i can implement such query on Nagios?
Thanks,
Amit