ElasticSearch

Dashboard

ElasticSearch metrics
Last updated: 6 months ago

Downloads: 400

  • 1.png
    1.png
  • 5.png
    5.png
  • 4.png
    4.png
  • 3.png
    3.png
  • 2.png
    2.png

You will need the Prometheus exporter plugin for ElasticSearch ( https://github.com/justwatchcom/elasticsearch_exporter ) to run this dashboard

HOW TO make elasticsearch_exporter on centos-7:

yum  -y install golang
GOPATH=/usr/local go get -u github.com/justwatchcom/elasticsearch_exporter

RUN:

cat << EOF > /etc/systemd/system/elasticsearch_exporter.service
[Unit]
Description=Prometheus elasticsearch_exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target

[Service]
User=root
Nice=10
ExecStart = /usr/local/bin/elasticsearch_exporter 
ExecStop= /usr/bin/killall elasticsearch_exporter

[Install]
WantedBy=default.target
EOF

systemctl daemon-reload
systemctl enable elasticsearch_exporter.service
systemctl start  elasticsearch_exporter.service

Exampe config for prometheus.yml:

  - job_name: elasticsearch
    scrape_interval: 30s
    metrics_path: "/metrics"
    static_configs:
    - targets:
      - graylog.prod.lan:9108
      - elastic1.test.lan:9108
      - elastic2.test.lan:9108
      - elastic3.test.lan:9108
      - elastic1.prod.lan:9108
      - elastic2.prod.lan:9108
      - elastic3.prod.lan:9108
      labels:
        service: elasticsearch
    relabel_configs:
    - source_labels: [__address__]
      regex: '(.*)\:9108'
      target_label:  'instance'
      replacement:   '$1'
    - source_labels: [__address__]
      regex:         '.*\.(.*)\.lan.*'
      target_label:  'environment'
      replacement:   '$1'

Exampe config for prometheus alerts.rules:

ALERT Elastic_UP
  IF elasticsearch_up{job="elasticsearch"} != 1
  FOR 10s
  LABELS { severity="alert", value = "{{$value}}" }
  ANNOTATIONS {
    summary = "Instance {{ $labels.instance }}: Elasticsearch instance status is not 1",
    description = "This server's Elasticsearch instance status has a value of {{ $value }}.",
  }

ALERT Elastic_Cluster_Health
  IF elasticsearch_cluster_health_status_is_green{job="elasticsearch"} != 1
  FOR 10s
  LABELS { severity="alert", value = "{{$value}}" }
  ANNOTATIONS {
    summary = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster",
    description = "Instance {{ $labels.instance }}: not all primary and replica shards are allocated in elasticsearch cluster, cluster health has a value of {{ $value }}.",
  }

ALERT Elasticsearch_JVM_Heap_Too_High
 IF elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"} > 0.9
 FOR 15m
 LABELS { severity="alert", value = "{{$value}}" }
 ANNOTATIONS {
    summary = "ElasticSearch node {{ $labels.instance }} heap usage is high",
    description = "The heap in {{ $labels.instance }} is over 90% for 15m.",
  }