一、对于elasticsearch-exporter

elasticsearch_exporter与ES集群是离开独立,不须要对原有的ES集群(可能有很多个)做任何批改,不须要重启,只有能拜访es集群即可。

二、装置

1.下载elasticsearch_exporter-1.1.0.linux-amd64.tar.gz安装包并解压到/usr/local目录
抉择对应的版本进行下载:elasticsearch_exporter

# 下载wget https://github.com/justwatchcom/elasticsearch_exporter/releases/download/v1.1.0/elasticsearch_exporter-1.1.0.linux-amd64.tar.gz# 解压tar -xvf elasticsearch_exporter-1.1.0.linux-amd64.tar.gzcd elasticsearch_exporter-1.1.0.linux-amd64/

三、启动

1.罕用参数解释

## 参数阐明:--es.uri             默认http://localhost:9200,连贯到的Elasticsearch节点的地址(主机和端口)。 这能够是本地节点(例如localhost:9200),也能够是近程Elasticsearch服务器的地址--es.all                默认flase,如果为true,则查问群集中所有节点的统计信息,而不仅仅是查问咱们连贯到的节点。--es.cluster_settings   默认flase,如果为true,请在统计信息中查问集群设置--es.indices            默认flase,如果为true,则查问统计信息以获取集群中的所有索引。--es.indices_settings   默认flase,如果为true,则查问集群中所有索引的设置统计信息。--es.shards             默认flase,如果为true,则查问集群中所有索引的统计信息,包含分片级统计信息(意味着es.indices = true)。--es.snapshots          默认flase,如果为true,则查问集群快照的统计信息。

2.只有设置不同的-web.listen-address监听端口,可启动多个实例,别离监控不同的ES集群:

# es集群1:10.xxx.xxx.10:9200nohup ./elasticsearch_exporter --es.all --es.indices --es.cluster_settings --es.indices_settings --es.shards --es.snapshots --es.timeout=10s --web.listen-address=":9114" --web.telemetry-path="/metrics" --es.uri http://10.xxx.xxx.10:9200 & # es集群2:10.xxx.xxx.11:9200nohup ./elasticsearch_exporter --es.all --es.indices --es.cluster_settings --es.indices_settings --es.shards --es.snapshots --es.timeout=10s --web.listen-address=":9115" --web.telemetry-path="/metrics" --es.uri http://10.xxx.xxx.11:9200 &

3.如果es集群开启了x-pack验证则能够应用如下:

nohup ./elasticsearch_exporter --es.all --es.indices --es.cluster_settings --es.indices_settings --es.shards --es.snapshots  --es.uri http://用户名:明码@111.xxx.xxx.6:9200 &

四、prometheus配置及grafana配置

  1. prometheus配置
- job_name: 'elasticsearch'      static_configs:    - targets: ['111.xx.xxx.1:9114']

2.grafana配置
导入2322模板
下载地址:https://grafana.com/grafana/dashboards/2322

五、参考附录

Elasticsearch集群监控:elasticsearch_exporter + Prometheus + Grafana
Prometheus + Grafana(十)系统监控之Elasticsearch
elasticsearch_exporter带账号密码认证配置