Skip to main content

Elasticsearch

Overview​

Elasticsearch is a distributed, open source search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured. Elasticsearch is built on Apache Lucene and was first released in 2010 by Elasticsearch N.V. (now known as Elastic).

Monitoring Connector assets​

Monitored objects​

  • Databases
  • Nodes
  • Shards
  • Clusters
  • Indices
  • Documents
  • Licences

Discovery rules​

Rule nameDescription
App-DB-Elasticsearch-Indice-StatisticsDiscover the indices on your Elasticsearch DB
App-DB-Elasticsearch-Node-StatisticsDiscover the nodes on your Elasticsearch DB

Use the discovery module to add the monitoring of your Elasticsearch databases, Go to Configuration > Services > Scan to perform a scan.

Collected metrics​

Metric nameDescriptionUnit
displayName of the Elasticsearch cluster
statusStatus of the Elasticsearch cluster
nodes_totalNumber of nodes
nodes_dataNumber of data
nodes_coordinatingNumber of nodes coordinating
nodes_masterNumber of master nodes
nodes_ingestNumber of ingest data
indices_countNumber of indices
shards_totalTotal number of shards
shards_activeNumber of active shards
shards_unassignedNumber of unassigned shards
shards_relocatingNumber of relocating shards
active_shards_percentPercentage of active shards%
tasks_pendingNumber of pending tasks
docs_countNumber of documents
size_in_bytesSize of all shards assignedB

Prerequisites​

In order to monitor an Elasticsearch cluster, it must be prepared acccording to Elasticsearch's official documentation.

In order to be able to communicate with the Elasticsearch node's API, the Centreon Poller should access to the port 9200 with the http protocol on the Elasticsearch node.

Installation​

  1. Install the Plugin on all Centreon pollers monitoring Elasticsearch ressources:
yum install centreon-plugin-Applications-Databases-Elasticsearch
  1. Install the Monitoring Connector 'Elasticsearch' in the Configuration > Monitoring Connector Manager page of the Web Centreon interface

Host Configuration​

Apply the "App-DB-Elasticsearch-custom" template to your newly created host. Then fill the macros value fileds marked as mandatory below:

MandatoryMacroDescriptionDefault valueExample
XELASTICSEARCHPORTThe Elasticsearch instance port92001234
XELASTICSEARCHPROTOThe Elasticsearch instance protocolhttphttps
ELASTICSEARCHUSERNAMEThe Elasticsearch instance usernamecentreon
ELASTICSEARCHPASSWORDThe Elasticsearch instance passwordcentreon

FAQ​

How to check in the CLI that the configuration is OK and what are the main options for ?​

One the Plugin is installed, you can test it directly in the command line from your Centreon poller with the user centreon-engine:

/usr/lib/centreon/plugins/centreon_elasticsearch.pl \ 
--hostname=168.253.16.125 \
--port=9200 \
--proto=http \
--plugin=database::elasticsearch::restapi::plugin \
--mode=node-statistics \
--filter-name='Node 1' \
--username='Elasticsearch_username' \
--warning-disk-free='20%' \
--critical-disk-free='5%'

Output:

OK: Node 'i-Vertix Node 1' JVM Heap: 26%, Free Disk Space: 1.56TB, Documents: 4362761044, Data: 1.26TB | 'i-Vertix Node 1#node.jvm.heap.usage.percentage'=26%;;;0;100 'i-Vertix Node 1#node.jvm.heap.usage.bytes'=36380302240B;;;0;137151119360 'i-Vertix Node 1#node.disk.free.bytes'=1710072680448B;;;0;3113589145600 'i-Vertix Node 1#node.documents.total.count'=4362761044;;;0; 'i-Vertix Node 1#node.data.size.bytes'=1386278479651B;;;0;

The command request statistic to the Elasticsearch node named 'Node 1' (--mode=node-statistics --filter-name='Node 1) with the IP/FQDN address 168.253.16.125 (--hostname=168.253.16.125). We will use the port 9200 (--port=9200) and the http protocol (proto=http''). The username of the datebase is Elasticsearch_username (--username='Elasticsearch_username') and its pasword is Elasticsearch_password(--password='Elasticsearch_password'). This command will trigger a WARNING alert if there is less than 20% of free space on the disk (--warning-disk-free='20%'') and a CRITICAL alert if less than 5% (--critical-disk-free='5%'). Some thresholds can also be set on metrics with options "--warning-" and "--critical-".

All the available modes can be listed with the command line:

/usr/lib/centreon/plugins/centreon_elasticsearch.pl \
--list-mode

And the different mode's options can be displayed with the --help parameter:

/usr/lib/centreon/plugins/centreon_elasticsearch.pl \
--mode=node-statistics \
--help

Why do I get the following error:​

UNKNOWN: 500 Can't connect​

This error message means that the Centreon Plugin couldn't successfully connect to the host API. Check that no third party device (such as a firewall) is blocking the request. A proxy connection may also be necessary to connect to the API. This can be done by using the --proxyurl option in the command.

UNKNOWN: 501 Protocol scheme 'connect' is not supported​

When using a proxy to connect to the host, this error message means that the Centreon Plugin library does not support the proxy connection protocol.

In order to prevent this issue, use the curl HTTP backend by adding the following option to the command: --http-backend='curl'.