Simple and usefull monit conf for elasticsearch

Getting your elasticsearch cluster running is not so long. But now you have to properly monitor it.

It can be down even if the server is still up and even the “java elasticsearch process”.

Here is a nice monit conf grab from chef elasticsearch cookbook:


Will send a mail if the http api not reply and the last but not least will send a mail if the cluster is in another state than green (this is the beggining of the end sometimes ;) ).

You have to install this on each node.

In my case i run all my node with monit (ping me if you want a 30 seconds monit install on debian like).

5 replies
  1. Ruben
    Ruben says:


    I’ve tried this code but Monit complaints about regular expresion, any thoughts? The first logic works ok but the second fails :S

    [CEST Apr 27 12:25:05] error : ‘elasticsearch_cluster_health’ failed protocol test [HTTP] at INET[localhost:9200/_cluster/health] via TCP — HTTP error: Regular expression doesn’t match: No match

    Thanks anyway!

  2. Dmitry
    Dmitry says:

    Fixed that code for my purposes:
    check host elasticsearch_connection with address
    start program = “/usr/bin/env service elasticsearch start”
    stop program = “/usr/bin/env service elasticsearch stop”
    if failed url with timeout 15 seconds then restart
    group elasticsearch

  3. Mathieu ELIE
    Mathieu ELIE says:

    Yes. You need to use the hipchat api and and a custom alert script in monit. Use “then exec” in monit.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *