How to monitor elasticsearch using nagios

Noam picture Noam · Apr 23, 2012 · Viewed 18.7k times · Source

I would like to monitor elasticsearch using nagios. Basiclly, I want to know if elasticsearch is up.

I think I can use the elasticsearch Cluster Health API (see here)

and use the 'status' that I get back (green, yellow or red), but I still don't know how to use nagios for that matter ( nagios is on one server and elasticsearc is on another server ).

Is there another way to do that?

EDIT : I just found that - check_http_json. I think I'll try it.

Answer

Noam picture Noam · May 9, 2012

After a while - I've managed to monitor elasticsearch using the nrpe. I wanted to use the elasticsearch Cluster Health API - but I couldn't use it from another machine - due to security issues... So, in the monitoring server I created a new service - which the check_command is check_command check_nrpe!check_elastic. And now in the remote server, where the elasticsearch is, I've editted the nrpe.cfg file with the following:

command[check_elastic]=/usr/local/nagios/libexec/check_http -H localhost -u /_cluster/health -p 9200 -w 2 -c 3 -s green

Which is allowed, since this command is run from the remote server - so no security issues here...

It works!!! I'll still try this check_http_json command that I posted in my qeustion - but for now, my solution is good enough.