This is a simple Nagios check script to monitor all nodes of your Elasticsearch Cluster.
Fedele Mantuano (Twitter: @fedelemantuano)
In your Nagios plugins directory run
git clone https://github.com/fedelemantuano/nagios-plugin-elasticsearch.git
Edit your commands.cfg and add the following
define command {
command_name check_heap_used_percent
command_line /opt/nagios-plugin-elasticsearch/check_elasticsearch.py -D -n $ARG1$ -c $ARG2$ node --heap-used-percent
}
(add -D
to the command if you want to add perfdata to the output)
(add -G
to the command if you want only output)
(add -D -G
to the command if you want only output and graph)
Then you can reference it like the following.
define service {
use generic-service
host_name node_cluster
service_description ELASTICSEARCH - Node Heap used percent
check_command check_heap_used_percent!node_name!client_node
}
check_elasticsearch.py [-h] [-n NODE_NAME] [-c CLIENT_NODE] [-D] [-G]
[-v]
{cluster,node,indices} ...
Elasticsearch Nagios checks
positional arguments:
{cluster,node,indices}
All Elasticsearch checks groups
cluster All Cluster checks
node All Node checks
indices All indices checks
optional arguments:
-h, --help show this help message and exit
-n NODE_NAME, --node-name NODE_NAME
Node name in the Cluster
-c CLIENT_NODE, --client-node CLIENT_NODE
Client node name (FQDN) for HTTP communication
-D, --perf-data Enable Nagios performance data (Valid for all checks
groups)
-G, --only-graph Enable Nagios to print only message
-v, --version show program's version number and exit
check_elasticsearch.py cluster [-h] [--cluster-health]
optional arguments:
-h, --help show this help message and exit
--cluster-health Check the Cluster health (green, yellow, red)
check_elasticsearch.py node [-h] [--heap-used-percent]
[--documents-count]
[--ratio-search-query-time]
optional arguments:
-h, --help show this help message and exit
--heap-used-percent Check the Heap used percent
--documents-count Documents on node
--ratio-search-query-time
Ratio search query_time_in_millis/query_total
check_elasticsearch.py indices [-h] [--index INDEX] [--prefix PREFIX]
[--doc-type DOC_TYPE] [--last-entry]
optional arguments:
-h, --help show this help message and exit
--index INDEX Index name
--prefix PREFIX Include only indices beginning with prefix
--doc-type DOC_TYPE Include only documents with doc-type
--last-entry Check last entry in the index. Only for timestamp in
UTC