Last update: April 26, 2019

This is a monitoring plugin to check the status of an ElasticSearch cluster node. Besides the classical status check (green, yellow, red) this plugin also allows to monitor disk or memory usage of Elasticsearch. This is especially helpful when running Elasticsearch in the cloud (e.g. Elasticsearch as a service) because, as ES does not run on your own server, you cannot monitor the disk or memory usage. This is where this plugin comes in. Just tell the plugin how much resources (diskspace, memory capacity) you have available (-d) and it will alarm you when you reach a threshold.



1343 downloads so far...

Download plugin and save it in your Nagios/Monitoring plugin folder (usually /usr/lib/nagios/plugins, depends on your distribution). Afterwards adjust the permissions (usually chmod 755).

Community contributions welcome on GitHub repo.

Version history / Changelog

20160429: Started programming plugin
20160601: Continued programming. Working now as it should =)
20160906: Added memory usage check, check types option (-t)
20160906: Renamed plugin from check_es_store to check_es_system
20160907: Change internal referenced variable name for available size
20160907: Output now contains both used and available sizes
20161017: Add missing -t in usage output
20180105: Fix if statement for authentication (@deric)
20180105: Fix authentication when wrong credentials were used
20180313: Configure max_time for Elastic to respond (@deric)
20190219: Fix alternative subject name in ssl (issue 4), direct to auth
20190220 1.1: Added status check type
20190403 1.2: Check for mandatory parameter checktype, adjust help
20190403 1.3: Catch connection refused error
20190426 1.4: Catch unauthorized (403) error


  • curl (SUSE: zypper in curl, Debian/Ubuntu: apt-get install curl, CentOS/RHEL: yum install curl)
  • jshon command (SUSE: search for jshon, Debian/Ubuntu: apt-get install jshon
  • Bash internal commands/functions (plugin checks for its existance)

Definition of the parameters

Parameter Description
-H* Hostname or ip address of ElasticSearch Node
-P Port (defaults to 9200)
-S Use secure http (https)
-u Username if authentication is required
-p Password if authentication is required
-t* Type of check to run (disk|mem|status)
-d+ Available disk or memory size (ex. 20)
-o Size unit (K|M|G) (defaults to G)
-w Warning threshold in percent (default: 80)
-c Critical threshold in percent (default: 95)
-m Maximum time in seconds to wait for Elasticsearch server response (default: 30)
-h Help!

* mandatory parameter

+ mandatory for check types disk and mem

Definition of the check types

Type Description
status Check the current status of the cluster (green, yellow, red). Besides that shows additional information (nodes, shards, docs). When the status is yellow or red, the relevant shard information is shown (e.g. initializing or unassigned)..
mem Check the current memory usage and compare it with the available memory defined with -d parameter. Thresholds possible.
disk Check the current disk usage and compare it with the available disk capacity defined with -d parameter. Thresholds possible.

Usage / running the plugin on the command line


./ -H hostname [-P port] [-S] [-u user] [-p password] -t checktype [-d capacity] [-o unit] [-w warning] [-c critical] [-m time]

Example 1: Classical status check. Here the Elasticsearch cluster runs on and is accessed using HTTPS (-S to enable https) on port 9243 using the basic auth credentials user and password. The output shows the cluster status (green) and some additional information.
As performance data the node numbers, shard information and total number of documents are used.
Note: When the status changes to yellow (= WARNING) or red (=CRITICAL) the output also contains information of relocating, initializing and unassigned shards. The performance data stays the same to not confuse graphing databases.

./ -H -P 9243 -S -u user -p password -t status
ES SYSTEM OK - Elasticsearch Cluster is green (3 nodes, 2 data nodes, 114 shards, 8426885 docs)|total_nodes=3;;;; data_nodes=2;;;; total_shards=114;;;; relocating_shards=0;;;; initializing_shards=0;;;; unassigned_shards=0;;;; docs=8426885;;;;

Example 2: Disk usage check. The same Elasticsearch cluster as before is accessed. As this ES runs in the cloud, we do not have host monitoring available (meaning: We cannot do file system monitoring). But we know, we have 128GB available disk space. We tell the plugin we have a capacity of 128GB (-d 128). Let the plugin do the rest:

./ -H -P 9243 -S -u user -p password -t disk -d 128
ES SYSTEM OK - Disk usage is at 14% (18 G from 128 G)|es_disk=19637018938B;109951162777;130567005798;;

Example 3: Memory usage check. Same as before, ES runs in the cloud and we cannot do memory monitoring on the host itself. But we have booked our Elasticsearch service with 24GB RAM/memory.

./ -H -P 9243 -S -u user -p password -t mem -d 24
ES SYSTEM OK - Memory usage is at 58% (14 G from 24 G)|es_memory=15107616304B;20615843020;24481313587;;

Command definition

Command definition in Nagios, Icinga 1.x, Shinken, Naemon

# 'check_es_system' command definition
define command{
  command_name check_es_system
  command_line $USER1$/ -H $ARG1$ -d $ARG2$ -t $ARG3$ $ARG4$

Command definition in Icinga 2.x

object CheckCommand "check_es_system" {
  import "plugin-check-command"
  command = [ PluginContribDir + "/" ]

   arguments = {
      "-H" = {
        value = "$es_address$"
        description = "Hostname or IP Address of ElasticSearch node"

      "-P" = {
        value = "$es_port$"
        description = "Port number (default: 9200)"

      "-S" = {
        set_if = "$es_ssl$"
        description = "Use https"

      "-u" = {
        value = "$es_user$"
        description = "Username if authentication is required"

      "-p" = {
        value = "$es_password$"
        description = "Password if authentication is required"

      "-d" = {
        value = "$es_available$"
        description = "Define the available disk or memory size of your ES cluster"

      "-t" = {
        value = "$es_checktype$"
        description = "Define the type of check (disk|mem|status)"

      "-o" = {
        value = "$es_unit$"
        description = "Choose sizing unit (K|M|G) - defaults to G for GigaByte"

      "-w" = {
        value = "$es_warn$"
        description = "Warning threshold in percent (default: 80)"

      "-c" = {
        value = "$es_crit$"
        description = "Critical threshold in percent (default: 95)"

      "-m" = {
        value = "$es_max_time$"
        description = "Maximum time in seconds (timeout) for Elasticsearch to respond (default: 30)"

  vars.es_address = "$address$"
  vars.es_ssl = false

Service definition

Service definition in Nagios, Icinga 1.x, Shinken, Naemon

In this example, the disk check happens on and assumes a 50GB available disk space. There is authentication required to access the cluster statistics so here the login happens with user "read" and password "only".

# Check ElasticSearch Store
define service{
  use generic-service
  host_name myesnode
  service_description ElasticSearch Disk Usage
  check_command check_es_system!!50!disk!-u read -p only

Service object definition Icinga 2.x

In this example, the disk check happens on and assumes a 50GB available disk space. There is authentication required to access the cluster statistics so here the login happens with user "read" and password "only".

# Check Elasticsearch Disk Usage
object Service "ElasticSearch Disk Usage" {
  import "generic-service"
  host_name = "myesnode"
  check_command = "check_es_system"
  vars.es_address = ""
  vars.es_user = "read"
  vars.es_password = "only"
  vars.es_checktype = "disk"
  vars.es_available = "50"

In this example, the status of Elasticsearch running on is checked. There is authentication required to access the cluster statistics so here the login happens with user "read" and password "only".

# Check Elasticsearch Status
object Service "ElasticSearch Status" {
  import "generic-service"
  host_name = "myesnode"
  check_command = "check_es_system"
  vars.es_address = ""
  vars.es_user = "read"
  vars.es_password = "only"
  vars.es_checktype = "status"


check_es_system Elasticsearch cluster yellow status
check_es_system Elasticsearch yellow status
check_es_system capacity checks
Grafana show performance data Elasticsearch unassigned shards check_es_system plugin