<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export><version>5.0</version><date>2021-11-21T21:54:00Z</date><groups><group><name>Templates</name></group></groups><templates><template><template>App Elasticsearch Cluster new</template><name>App Elasticsearch Cluster new</name><description>## Overview

**ElasticSearch Zabbix monitoring**
===================================


#### Script-free Zabbix ES monitoring


 


This template monitores all ES cluster using Zabbix 4.x HTTP Agent resource.


This allows check ES being OnPremise or PAAS (AWS Elasticsearch, for example) without additional scripts.


 


### Requisites:


* ES available for Zabbix server or a Zabbix proxy. That's all.
* ES Endpoints can be adjusted on template macro.


 


### **Discovers:**


* ES Indexes discovery  
ES Node discovery


### **Monitored Items:**


* Shards
* Cluster Rate
* Cluster Latency
* Cluster Health
* JVM Stats
* Disk Status
* Snapshot status
* ES Port
* Memory
* Documents (searchable, deleted)


 


 


 


 


 


 



## Author

Rickk Barbosa (https://github.com/rickkbarbosa)

</description><groups><group><name>Templates</name></group></groups><applications><application><name>ES Cluster</name></application><application><name>ES Data</name></application><application><name>ES General status</name></application><application><name>ES Health</name></application><application><name>ES JVM Stats</name></application><application><name>ES Key performance indicators</name></application><application><name>ES Shards</name></application></applications><items><item><name>Elasticsearch Memory (Average per Node)</name><type>CALCULATED</type><key>elasticsearch.cluster.memory[total,pernode]</key><delay>5m</delay><history>1w</history><value_type>FLOAT</value_type><units>b</units><params>last(&quot;elasticsearch.memory[total,cluster]&quot;) / last(&quot;elasticsearch.cluster[number_of_nodes]&quot;)</params><description>Total memory (sum of all nodes)</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications></item><item><name>Elasticsearch - Number of active primary shards</name><type>DEPENDENT</type><key>elasticsearch.cluster[active_primary_shards]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application><application><name>ES Shards</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.active_primary_shards</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch - Number of active shards</name><type>DEPENDENT</type><key>elasticsearch.cluster[active_shards]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application><application><name>ES Shards</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.active_shards</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch Cluster Health</name><type>HTTP_AGENT</type><key>elasticsearch.cluster[all,health]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Cluster</name></application></applications><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cluster/health</url></item><item><name>Elasticsearch Cluster Global Status</name><type>HTTP_AGENT</type><key>elasticsearch.cluster[all,stats]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Cluster</name></application></applications><timeout>5s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cluster/stats</url></item><item><name>Elasticsearch - Number of data nodes</name><type>DEPENDENT</type><key>elasticsearch.cluster[cluster,number_of_data_nodes]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.number_of_data_nodes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Master instance connection status</name><type>DEPENDENT</type><key>elasticsearch.cluster[discovered_master]</key><delay>0</delay><history>1w</history><description>Master instance connection status.&#13;
&#13;
Indicates whether data nodes can reach the master node. Failures are usually the result of a network connectivity problem.</description><applications><application><name>ES Health</name></application></applications><valuemap><name>Boolean</name></valuemap><preprocessing><step><type>JSONPATH</type><params>$.discovered_master</params></step><step><type>REGEX</type><params>true
1</params><error_handler>CUSTOM_ERROR</error_handler><error_handler_params>0</error_handler_params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item></item><item><name>Elasticsearch - Number of initializing shards</name><type>DEPENDENT</type><key>elasticsearch.cluster[initializing_shards]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application><application><name>ES Shards</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.initializing_shards</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch - Cluster Name</name><type>DEPENDENT</type><key>elasticsearch.cluster[name]</key><delay>0</delay><history>1w</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Cluster</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.cluster_name</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item></item><item><name>Number of nodes</name><type>DEPENDENT</type><key>elasticsearch.cluster[number_of_nodes]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.number_of_nodes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch - Number of relocating shards</name><type>DEPENDENT</type><key>elasticsearch.cluster[relocating_shards]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application><application><name>ES Shards</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.relocating_shards</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch - Cluster Size</name><type>DEPENDENT</type><key>elasticsearch.cluster[size]</key><delay>0</delay><history>1w</history><units>b</units><description>Total cluster size in bytes</description><applications><application><name>ES Cluster</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.indices.store.size_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch - Cluster Status</name><type>DEPENDENT</type><key>elasticsearch.cluster[status]</key><delay>0</delay><history>1w</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Cluster</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.status</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method><triggers><trigger><expression>{iregexp(green,3)}=0</expression><recovery_mode>RECOVERY_EXPRESSION</recovery_mode><recovery_expression>{iregexp(green,3)}=1</recovery_expression><name>[ {HOST.NAME} ] - Elasticsearch Cluster in {ITEM.LASTVALUE} state</name><priority>WARNING</priority><description>The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.</description><dependencies><dependency><name>[ {HOST.NAME} ] - Elasticsearch Cluster in {ITEM.LASTVALUE} state</name><expression>{App Elasticsearch Cluster new:elasticsearch.cluster[status].iregexp(green,5)}=0</expression><recovery_expression>{App Elasticsearch Cluster new:elasticsearch.cluster[status].iregexp(green,3)}=1</recovery_expression></dependency></dependencies></trigger><trigger><expression>{iregexp(green,5)}=0</expression><recovery_mode>RECOVERY_EXPRESSION</recovery_mode><recovery_expression>{iregexp(green,3)}=1</recovery_expression><name>[ {HOST.NAME} ] - Elasticsearch Cluster in {ITEM.LASTVALUE} state</name><priority>AVERAGE</priority><description>The cluster health status is: green, yellow or red. On the shard level, a red status indicates that the specific shard is not allocated in the cluster, yellow means that the primary shard is allocated but replicas are not, and green means that all shards are allocated. The index level status is controlled by the worst shard status. The cluster status is controlled by the worst index status.</description></trigger><trigger><expression>{nodata(5m)}=1</expression><recovery_mode>RECOVERY_EXPRESSION</recovery_mode><recovery_expression>{nodata(3m)}=0</recovery_expression><name>[ {HOST.NAME} ] - Elasticsearch Monitoring is not collecting data</name><priority>AVERAGE</priority><dependencies><dependency><name>[ {HOST.NAME} ] - Elasticsearch Port is unavailable</name><expression>{App Elasticsearch Cluster new:net.tcp.service[tcp,{$ELASTICSEARCH_HOST},{$ELASTICSEARCH_PORT}].sum(#3)}=0</expression><recovery_expression>{App Elasticsearch Cluster new:net.tcp.service[tcp,{$ELASTICSEARCH_HOST},{$ELASTICSEARCH_PORT}].avg(#3)}=1</recovery_expression></dependency></dependencies></trigger></triggers></item><item><name>Elasticsearch - Number of unassigned shards</name><type>DEPENDENT</type><key>elasticsearch.cluster[unassigned_shards]</key><delay>0</delay><history>1w</history><applications><application><name>ES Cluster</name></application><application><name>ES Shards</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.unassigned_shards</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,health]</key></master_item><request_method>POST</request_method></item><item><name>Elasticsearch Cluster UUID</name><type>DEPENDENT</type><key>elasticsearch.cluster[uuid]</key><delay>0</delay><history>1w</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Cluster</name></application><application><name>ES General status</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.cluster_uuid</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch CPU Usage</name><type>DEPENDENT</type><key>elasticsearch.cpu</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>%</units><description>CPU Usage in percent on Cluster. It checks all node.</description><applications><application><name>ES Cluster</name></application><application><name>ES Health</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.process.cpu.percent</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Deleted documents</name><type>DEPENDENT</type><key>elasticsearch.deleted</key><delay>0</delay><history>1d</history><description>Total Number of Records marked for deletion</description><applications><application><name>ES Data</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.indices.docs.deleted</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch Disk Volume</name><type>HTTP_AGENT</type><key>elasticsearch.disk[all]</key><delay>10m</delay><history>1d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES General status</name></application></applications><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_nodes/stats/fs</url></item><item><name>Elasticsearch Disk Free (%)</name><type>CALCULATED</type><key>elasticsearch.disk[free,percent]</key><delay>5m</delay><history>1w</history><value_type>FLOAT</value_type><units>%</units><params>( last(&quot;elasticsearch.disk[free]&quot;) / last(&quot;elasticsearch.disk[total]&quot;) ) * 100</params><description>Free disk volume (in percent)</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications></item><item><name>Elasticsearch Disk Volume Free</name><type>DEPENDENT</type><key>elasticsearch.disk[free]</key><delay>0</delay><history>1d</history><units>b</units><applications><application><name>ES Health</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.fs.total.free_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.disk[all]</key></master_item></item><item><name>Elasticsearch Disk Volume Total</name><type>DEPENDENT</type><key>elasticsearch.disk[total]</key><delay>0</delay><history>1d</history><units>b</units><applications><application><name>ES Health</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.fs.total.total_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.disk[all]</key></master_item></item><item><name>Elasticsearch Indices Global Status</name><type>HTTP_AGENT</type><key>elasticsearch.indices[all,stats]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><description>Indices level stats provide statistics on different operations happening on an index. The API provides statistics on the index level scope (though most stats can also be retrieved using node level scope).&#13;
&#13;
Base for key performance indicator&#13;
&#13;
https://www.elastic.co/guide/en/elasticsearch/reference/6.4/indices-stats.html</description><applications><application><name>ES General status</name></application><application><name>ES Key performance indicators</name></application></applications><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_stats</url></item><item><name>Elasticsearch JVM Heap (Max)</name><type>DEPENDENT</type><key>elasticsearch.jvm[heap,max]</key><delay>0</delay><history>1w</history><units>b</units><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html</description><applications><application><name>ES JVM Stats</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.jvm.mem.heap_max_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch JVM Heap (Used, Percent)</name><type>CALCULATED</type><key>elasticsearch.jvm[heap,usedp]</key><delay>5m</delay><history>1w</history><value_type>FLOAT</value_type><units>%</units><params>(  last(&quot;elasticsearch.jvm[heap,used]&quot;) / last(&quot;elasticsearch.jvm[heap,max]&quot;) ) *100</params><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html</description><applications><application><name>ES JVM Stats</name></application></applications><triggers><trigger><expression>{avg(#3)}&gt;{$ELASTICSEARCH_HEAPMEM_P2}</expression><name>[ {HOST.NAME} ] - Elasticsearch Heap Memory Used is over {$ELASTICSEARCH_HEAPMEM_P2}</name><priority>AVERAGE</priority></trigger></triggers></item><item><name>Elasticsearch JVM Heap (Used, bytes)</name><type>DEPENDENT</type><key>elasticsearch.jvm[heap,used]</key><delay>0</delay><history>1w</history><units>b</units><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html</description><applications><application><name>ES JVM Stats</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.jvm.mem.heap_used_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch JVM Version</name><type>DEPENDENT</type><key>elasticsearch.jvm[version]</key><delay>0</delay><history>1w</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES JVM Stats</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.jvm.versions</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch Memory Free (%)</name><type>CALCULATED</type><key>elasticsearch.memory[free,cluster,percentage]</key><delay>5m</delay><history>1w</history><value_type>FLOAT</value_type><units>%</units><params>( last(&quot;elasticsearch.memory[free,cluster]&quot;) / last(&quot;elasticsearch.memory[total,cluster]&quot;) ) * 100</params><description>Free memory in cluster (in percent)</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications></item><item><name>Elasticsearch Memory Free</name><type>DEPENDENT</type><key>elasticsearch.memory[free,cluster]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>b</units><description>Free memory on cluster (sum of all nodes)</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.os.mem.free_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch Memory (Cluster)</name><type>DEPENDENT</type><key>elasticsearch.memory[total,cluster]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>b</units><description>Total memory (sum of all nodes)</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.os.mem.total_in_bytes</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch - Indexing rate</name><type>DEPENDENT</type><key>elasticsearch.performance[index]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>ops/min</units><description>Number of index operations per minute.</description><applications><application><name>ES Health</name></application><application><name>ES Key performance indicators</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$._all.primaries.indexing.index_total</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item><item><name>Elasticsearch - Indexing latency (ms)</name><type>DEPENDENT</type><key>elasticsearch.performance[latency,index]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>ms</units><description>Average time that it takes a shard to complete and indexing operation</description><applications><application><name>ES Health</name></application><application><name>ES Key performance indicators</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$._all.primaries.indexing.index_time_in_millis</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item><item><name>Elasticsearch - Search latency (ms)</name><type>DEPENDENT</type><key>elasticsearch.performance[latency,search]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>ms</units><description>Average time that takes a shard to complete a search operation</description><applications><application><name>ES Health</name></application><application><name>ES Key performance indicators</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$._all.primaries.search.query_time_in_millis</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item><item><name>Elasticsearch - Search rate</name><type>DEPENDENT</type><key>elasticsearch.performance[search]</key><delay>0</delay><history>1w</history><value_type>FLOAT</value_type><units>ops/min</units><description>Search operations per minute.</description><applications><application><name>ES Health</name></application><application><name>ES Key performance indicators</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$._all.primaries.search.query_total</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item><item><name>Searchable documents</name><type>DEPENDENT</type><key>elasticsearch.records</key><delay>0</delay><history>1d</history><description>Total Number of Records</description><applications><application><name>ES Data</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.indices.docs.count</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch Well-done Snapshots in last {$ELASTICSEARCH_SNAPSHOTP_DAYS} days</name><type>DEPENDENT</type><key>elasticsearch.snapshots[ok]</key><delay>0</delay><history>1w</history><description>Total snapshots in the last {$ELASTICSEARCH_SNAPSHOTP_DAYS} days that has been succeed</description><applications><application><name>ES Health</name></application></applications><valuemap><name>Boolean</name></valuemap><preprocessing><step><type>REGEX</type><params>,([0-9]+)
\0</params></step><step><type>TRIM</type><params>,</params></step></preprocessing><master_item><key>elasticsearch.snapshots[stats]</key></master_item></item><item><name>ES Snapshot Status</name><type>HTTP_AGENT</type><key>elasticsearch.snapshots[stats]</key><delay>1h</delay><history>1d</history><trends>0</trends><value_type>TEXT</value_type><description>A snapshot is a backup taken from a running Elasticsearch cluster.&#13;
&#13;
This presents how many snapshots exists in the last 3 days and how many has been succeed.&#13;
&#13;
https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html</description><applications><application><name>ES General status</name></application><application><name>ES Health</name></application></applications><preprocessing><step><type>JAVASCRIPT</type><params>var lld = [];
var lines = value.split(&quot;\n&quot;);
var lines_num = lines.length;
//Date
var days = {$ELASTICSEARCH_SNAPSHOTP_DAYS}
days = 86400 * days
//daysAgo = 86400 //3 days
const now = new Date()  
const date = (Math.floor(Date.now() / 1000) - daysAgo)  
//Fetch last 3 days
var output = &quot; &quot;;
for (i = 0; i &lt; lines_num; i++)
{
  var line = lines[i].split(&quot; &quot;)[2];
  if (line &gt; date) {
    output = output + &quot;\n&quot; + lines[i];
  }
}//Regex
var re = /SUCCESS/g,
success = 0;
while (re.exec(output) !== null) {
    ++success;
}

var total = output.split(&quot;\n&quot;);
var total = total.length - 1;

result = total + &quot;,&quot; + success;
return result;</params></step></preprocessing><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/snapshots/{$ELASTICSEARCH_SNAPSHOT}</url></item><item><name>Elasticsearch Snapshots in last {$ELASTICSEARCH_SNAPSHOTP_DAYS} days</name><type>DEPENDENT</type><key>elasticsearch.snapshots[total]</key><delay>0</delay><history>1w</history><description>Total snapshots in the last 3 days</description><applications><application><name>ES Health</name></application></applications><valuemap><name>Boolean</name></valuemap><preprocessing><step><type>REGEX</type><params>^([0-9]+),
\0</params></step><step><type>RTRIM</type><params>,</params></step></preprocessing><master_item><key>elasticsearch.snapshots[stats]</key></master_item></item><item><name>Elasticsearch version</name><type>DEPENDENT</type><key>elasticsearch.version</key><delay>0</delay><history>1w</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES General status</name></application></applications><preprocessing><step><type>JSONPATH</type><params>$.nodes.versions[0]</params></step></preprocessing><master_item><key>elasticsearch.cluster[all,stats]</key></master_item></item><item><name>Elasticsearch port listen</name><type>SIMPLE</type><key>net.tcp.service[tcp,{$ELASTICSEARCH_HOST},{$ELASTICSEARCH_PORT}]</key><history>1w</history><applications><application><name>ES Health</name></application></applications><valuemap><name>Service state</name></valuemap><request_method>POST</request_method><triggers><trigger><expression>{sum(#3)}=0</expression><recovery_mode>RECOVERY_EXPRESSION</recovery_mode><recovery_expression>{avg(#3)}=1</recovery_expression><name>[ {HOST.NAME} ] - Elasticsearch Port is unavailable</name><priority>AVERAGE</priority></trigger></triggers></item></items><discovery_rules><discovery_rule><name>ES Indexes discovery</name><type>HTTP_AGENT</type><key>elasticsearch.discovery.indexes</key><filter><conditions><condition><macro>{#ELASTICSEARCH_INDEX}</macro><value>^(?!\s*$).+</value><formulaid>A</formulaid></condition></conditions></filter><lifetime>7d</lifetime><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html</description><item_prototypes><item_prototype><name>Elasticsearch index full info [ {#ELASTICSEARCH_INDEX} ]</name><type>HTTP_AGENT</type><key>elasticsearch.index[all,{#ELASTICSEARCH_INDEX}]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES General status</name></application></applications><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JAVASCRIPT</type><params>var lld = [];
var data = value.split(&quot; &quot;);

var row = {};
row[&quot;ELASTICSEARCH_INDEX_HEALTH&quot;] = data[0];
row[&quot;ELASTICSEARCH_INDEX_STATUS&quot;] = data[1];
row[&quot;ELASTICSEARCH_INDEX_NAME&quot;] = data[2];
row[&quot;ELASTICSEARCH_INDEX_UUID&quot;] = data[3];
row[&quot;ELASTICSEARCH_INDEX_DOCSCOUNT&quot;] = data[6];
row[&quot;ELASTICSEARCH_INDEX_DOCSDELETED&quot;] = data[7];
row[&quot;ELASTICSEARCH_INDEX_SIZE&quot;] = data[8];
row[&quot;ELASTICSEARCH_INDEX_PSIZE&quot;] = data[9];
lld.push(row);
return JSON.stringify(lld);</params></step><step><type>REGEX</type><params>.*
{&quot;data&quot;:\0</params></step><step><type>REGEX</type><params>.*
\0}</params></step></preprocessing><timeout>10s</timeout><url>http://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/indices/{#ELASTICSEARCH_INDEX}</url><query_fields><query_field><name>bytes</name><value>b</value></query_field></query_fields></item_prototype><item_prototype><name>Elasticsearch index documents [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[documents,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.data[0].ELASTICSEARCH_INDEX_DOCSCOUNT</params></step></preprocessing><master_item><key>elasticsearch.index[all,{#ELASTICSEARCH_INDEX}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch index documents deleted [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[documentsdeleted,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.data[0].ELASTICSEARCH_INDEX_DOCSDELETED</params></step></preprocessing><master_item><key>elasticsearch.index[all,{#ELASTICSEARCH_INDEX}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch index health [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[health,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><trends>0</trends><value_type>TEXT</value_type><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.data[0].ELASTICSEARCH_INDEX_HEALTH</params></step></preprocessing><master_item><key>elasticsearch.index[all,{#ELASTICSEARCH_INDEX}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch index latency [ {#ELASTICSEARCH_INDEX} ]  (ms)</name><type>DEPENDENT</type><key>elasticsearch.index[latency,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>ms</units><description>Average time that takes a shard to complete a search operation.&#13;
Specific for a index.</description><applications><application><name>ES Key performance indicators</name></application></applications><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.indices.{#ELASTICSEARCH_INDEX}.indexing.index_time_in_millis</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item_prototype><item_prototype><name>Elasticsearch queries [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[queries,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><description>Number of queries on this index</description><applications><application><name>ES Key performance indicators</name></application></applications><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.indices.{#ELASTICSEARCH_INDEX}.search.query_total</params></step><step><type>SIMPLE_CHANGE</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item_prototype><item_prototype><name>Elasticsearch index query latency [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[querylatency,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>ms</units><description>Search time in this index</description><applications><application><name>ES Key performance indicators</name></application></applications><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.indices.{#ELASTICSEARCH_INDEX}.search.query_time_in_millis</params></step><step><type>CHANGE_PER_SECOND</type><params/></step></preprocessing><master_item><key>elasticsearch.indices[all,stats]</key></master_item></item_prototype><item_prototype><name>Elasticsearch index size [ {#ELASTICSEARCH_INDEX} ]</name><type>DEPENDENT</type><key>elasticsearch.index[size,{#ELASTICSEARCH_INDEX}]</key><delay>0</delay><history>7d</history><units>b</units><application_prototypes><application_prototype><name>ES Indexes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.data[0].ELASTICSEARCH_INDEX_SIZE</params></step></preprocessing><master_item><key>elasticsearch.index[all,{#ELASTICSEARCH_INDEX}]</key></master_item></item_prototype></item_prototypes><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/indices</url><query_fields><query_field><name>h</name><value>index</value></query_field></query_fields><preprocessing><step><type>JAVASCRIPT</type><params>
var lld = [];
var lines = value.split(&quot;\n&quot;);
var lines_num = lines.length;
for (i = 0; i &lt; lines_num; i++)
{
  var row = {};
  row[&quot;{#ELASTICSEARCH_INDEX}&quot;] = lines[i]
  lld.push(row);
}
return JSON.stringify(lld);</params></step><step><type>REGEX</type><params>.*
{&quot;data&quot;:\0</params></step><step><type>REGEX</type><params>.*
\0}</params></step></preprocessing></discovery_rule><discovery_rule><name>ES Node discovery</name><type>HTTP_AGENT</type><key>elasticsearch.discovery.nodes</key><filter><conditions><condition><macro>{#ELASTICSEARCH_NODE}</macro><value>^(?!\s*$).+</value><formulaid>A</formulaid></condition></conditions></filter><lifetime>7d</lifetime><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html</description><item_prototypes><item_prototype><name>Elasticsearch full allocation info [ {#ELASTICSEARCH_NODE} ]</name><type>HTTP_AGENT</type><key>elasticsearch.node.disk[all,{#ELASTICSEARCH_NODE}]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><description>Provides a snapshot of the number of shards allocated to each data node and their disk space.&#13;
&#13;
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html</description><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><timeout>1m</timeout><url>http://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/allocation/{#ELASTICSEARCH_NODE}</url><query_fields><query_field><name>bytes</name><value>b</value></query_field></query_fields></item_prototype><item_prototype><name>Elasticsearch node [ {#ELASTICSEARCH_NODE} ] is master?</name><type>HTTP_AGENT</type><key>elasticsearch.node.master[{#ELASTICSEARCH_NODE}]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><description>Get information about master node.&#13;
https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-master.html</description><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><preprocessing><step><type>REGEX</type><params>{#ELASTICSEARCH_NODE}
1</params><error_handler>CUSTOM_VALUE</error_handler><error_handler_params>0</error_handler_params></step></preprocessing><timeout>1m</timeout><url>http://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/master</url><query_fields><query_field><name>h</name><value>node</value></query_field></query_fields></item_prototype><item_prototype><name>Elasticsearch full stats for node [ {#ELASTICSEARCH_NODE} ]</name><type>HTTP_AGENT</type><key>elasticsearch.node.query_cache[all,{#ELASTICSEARCH_NODE}]</key><history>1d</history><trends>0</trends><value_type>TEXT</value_type><description>Full stats for specific node as seen on&#13;
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-nodes-stats.html</description><applications><application><name>ES General status</name></application></applications><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><timeout>1m</timeout><url>http://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_nodes/{#ELASTICSEARCH_NODE}/stats</url></item_prototype><item_prototype><name>Elasticsearch CPU Load (1min)  [ {#ELASTICSEARCH_NODE} ]</name><type>DEPENDENT</type><key>elasticsearch.node[cpu1m,{#ELASTICSEARCH_NODE}]</key><delay>0</delay><history>7d</history><trends>0</trends><value_type>TEXT</value_type><applications><application><name>ES Health</name></application></applications><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><preprocessing><step><type>JSONPATH</type><params>$.nodes</params></step></preprocessing><master_item><key>elasticsearch.node.query_cache[all,{#ELASTICSEARCH_NODE}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch Storage Total [ {#ELASTICSEARCH_NODE} ]</name><type>DEPENDENT</type><key>elasticsearch.node[disk,{#ELASTICSEARCH_NODE},total]</key><delay>0</delay><history>7d</history><units>b</units><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html</description><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><preprocessing><step><type>REGEX</type><params>(?:(\d+)( )(\d+)( )((\d+|x)\.))
\0</params></step><step><type>REGEX</type><params>^([0-9]+)
\0</params></step></preprocessing><master_item><key>elasticsearch.node.disk[all,{#ELASTICSEARCH_NODE}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch Storage Used (in %) [ {#ELASTICSEARCH_NODE} ]</name><type>DEPENDENT</type><key>elasticsearch.node[disk,{#ELASTICSEARCH_NODE},usedp]</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>%</units><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html</description><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><preprocessing><step><type>REGEX</type><params>(?:(\d+)( )(\d+)( )((\d+|x)\.))
\0</params></step><step><type>REGEX</type><params>(( )[0-9]+)
\0</params></step></preprocessing><master_item><key>elasticsearch.node.disk[all,{#ELASTICSEARCH_NODE}]</key></master_item></item_prototype><item_prototype><name>Elasticsearch Storage Used [ {#ELASTICSEARCH_NODE} ]</name><type>DEPENDENT</type><key>elasticsearch.node[disk,{#ELASTICSEARCH_NODE},used]</key><delay>0</delay><history>7d</history><value_type>FLOAT</value_type><units>b</units><description>https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-allocation.html</description><application_prototypes><application_prototype><name>ES Nodes</name></application_prototype></application_prototypes><preprocessing><step><type>REGEX</type><params>(?:( )(\d+)( )(\d+))
\0</params></step><step><type>REGEX</type><params>([0-9]+)$
\0</params></step></preprocessing><master_item><key>elasticsearch.node.disk[all,{#ELASTICSEARCH_NODE}]</key></master_item></item_prototype></item_prototypes><timeout>10s</timeout><url>{$ELASTICSEARCH_PROTOCOL}://{$ELASTICSEARCH_HOST}:{$ELASTICSEARCH_PORT}/_cat/nodes</url><query_fields><query_field><name>h</name><value>name</value></query_field></query_fields><preprocessing><step><type>JAVASCRIPT</type><params>
var lld = [];
var lines = value.split(&quot;\n&quot;);
var lines_num = lines.length;
for (i = 0; i &lt; lines_num; i++)
{
  var row = {};
  row[&quot;{#ELASTICSEARCH_NODE}&quot;] = lines[i]
  lld.push(row);
}
return JSON.stringify(lld);</params></step><step><type>REGEX</type><params>.*
{&quot;data&quot;:\0</params></step><step><type>REGEX</type><params>.*
\0}</params></step></preprocessing></discovery_rule></discovery_rules><macros><macro><macro>{$ELASTICSEARCH_HEAPMEM_P2}</macro><value>75</value></macro><macro><macro>{$ELASTICSEARCH_HOST}</macro><value>localhost</value></macro><macro><macro>{$ELASTICSEARCH_PORT}</macro><value>9200</value></macro><macro><macro>{$ELASTICSEARCH_PROTOCOL}</macro><value>http</value></macro><macro><macro>{$ELASTICSEARCH_SNAPSHOT}</macro><value>cs-automated-enc</value></macro><macro><macro>{$ELASTICSEARCH_SNAPSHOTP_DAYS}</macro><value>3</value></macro></macros></template></templates><value_maps><value_map><name>Boolean</name><mappings><mapping><value>False</value><newvalue>0</newvalue></mapping><mapping><value>false</value><newvalue>0</newvalue></mapping><mapping><value>True</value><newvalue>1</newvalue></mapping><mapping><value>true</value><newvalue>1</newvalue></mapping></mappings></value_map><value_map><name>Service state</name><mappings><mapping><value>0</value><newvalue>Down</newvalue></mapping><mapping><value>1</value><newvalue>Up</newvalue></mapping></mappings></value_map></value_maps></zabbix_export>
