diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index 26d1b88138..35951f7c91 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -2761,7 +2761,7 @@ mongodb_disableretrywrites | **Optional.** If set to true, will disable Re #### elasticsearch -The [check_elasticsearch](https://github.com/anchor/nagios-plugin-elasticsearch) plugin +The [check_elasticsearch](https://github.com/NETWAYS/check_elasticsearch) plugin uses the HTTP API to monitor an [Elasticsearch](https://www.elastic.co/products/elasticsearch) node. Custom variables passed as [command parameters](03-monitoring-basics.md#command-passing-parameters): @@ -2769,11 +2769,12 @@ Custom variables passed as [command parameters](03-monitoring-basics.md#command- Name | Description -----------------------------|------------------------------------------------------------------------------------------------------- elasticsearch_host | **Optional.** Hostname or network address to probe. Defaults to "$address$" if the host's `address` attribute is set, "$address6$" otherwise. -elasticsearch_failuredomain | **Optional.** A comma-separated list of ElasticSearch attributes that make up your cluster's failure domain. -elasticsearch_masternodes | **Optional.** Issue a warning if the number of master-eligible nodes in the cluster drops below this number. By default, do not monitor the number of nodes in the cluster. elasticsearch_port | **Optional.** TCP port to probe. The ElasticSearch API should be listening here. Defaults to 9200. -elasticsearch_prefix | **Optional.** Optional prefix (e.g. 'es') for the ElasticSearch API. Defaults to ''. -elasticsearch_yellowcritical | **Optional.** Instead of issuing a 'warning' for a yellow cluster state, issue a 'critical' alert. Defaults to false. +elasticsearch_username | **Optional.** Username if authentication is required +elasticsearch_password | **Optional.** Password if authentication is required +elasticsearch_timeout | **Optional.** Allows to set timeout for execution of this plugin. +elasticsearch_tls | **Optional.** Use a HTTPS connection (default false) +elasticsearch_insecure | **Optional.** Skip the verification of the server's TLS certificate (default false) #### redis diff --git a/itl/plugins-contrib.d/databases.conf b/itl/plugins-contrib.d/databases.conf index 29b12463f2..26a1ce24c5 100644 --- a/itl/plugins-contrib.d/databases.conf +++ b/itl/plugins-contrib.d/databases.conf @@ -722,41 +722,79 @@ object CheckCommand "mongodb" { vars.mongodb_action = "connections" } -object CheckCommand "elasticsearch" { +template CheckCommand "elasticsearch" { import "ipv4-or-ipv6" - command = [ PluginContribDir + "/check_elasticsearch" ] + command = [ PluginDir + "/check_elasticsearch" ] arguments = { - "--failure-domain" = { - value = "$elasticsearch_failuredomain$" - description = "A comma-separated list of ElasticSearch attributes that make up your cluster's failure domain" - } - "--host" = { - value = "$elasticsearch_host$" - description = "Hostname or network address to probe, defaults to 'localhost'" - } - "--master-nodes" = { - value = "$elasticsearch_masternodes$" - description = "Issue a warning if the number of master-eligible nodes in the cluster drops below this number. By default, do not monitor the number of nodes in the cluster" - } - "--port" = { - value = "$elasticsearch_port$" - description = "TCP port to probe, defaults to 9200" - } - "--prefix" = { - value = "$elasticsearch_prefix$" - description = "Optional prefix for the ElasticSearch API, defaults to ''" - } - "--yellow-critical" = { - value = "TRUE" - set_if = "$elasticsearch_yellowcritical$" - description = "Instead of issuing a 'warning' for a yellow cluster state, issue a 'critical' alert" + "-H" = { + value = "$elasticsearch_hostname$" + description = "Hostname of the Elasticsearch instance (default 'localhost')" + } + "-p" = { + value= "$elasticsearch_port$" + description = "Port of the Elasticsearch instance (default 9200)" + } + "-U" = { + value = "$elasticsearch_username$" + description = "Username if authentication is required" + } + "-P" = { + value = "$elasticsearch_password$" + description = "Password if authentication is required" + } + "-S" = { + set_if = "$elasticsearch_tls$" + description = "Use a HTTPS connection (default false)" + } + "--insecure" = { + set_if = "$elasticsearch_insecure$" + description = "Skip the verification of the server's TLS certificate (default false)" + } + "-t" = { + value = "$elasticsearch_timeout$" + description = "Timeout in seconds for the CheckPlugin (default 30)" + }} +} + +object CheckCommand "elasticsearch-query" { + import "elasticsearch" + + command += [ "query" ] + + arguments += { + "-q" = { + value = "$elasticsearch_query$" + description = "The Elasticsearch query" + } + "-I" = { + value = "$elasticsearch_query_index$" + description = "Name of the Index which will be used (default '_all')" + } + "-k" = { + value = "$elasticsearch_query_msgkey$" + description = "Message of messagekey to display" + } + "-m" = { + value = "$elasticsearch_query_msglen$" + description = "Number of characters to display in the latest message (default 80)" + } + "-w" = { + value = "$elasticsearch_query_warning$" + description = "Warning threshold for total hits (default '20')" + } + "-c" = { + value = "$elasticsearch_query_critical$" + description = "Critical threshold for total hits (default '50')" } } +} + +object CheckCommand "elasticsearch-health" { + import "elasticsearch" - vars.elasticsearch_host = "$check_address$" - vars.elasticsearch_yellowcritical = false + command += [ "health" ] } object CheckCommand "redis" {