1.下载elasticsearch_exporter的二进制包并解压、运行
下载二进制包并解压、运行:
$ wget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.3.0/elasticsearch_exporter-1.3.0.linux-amd64.tar.gz
$ tar -xvf elasticsearch_exporter-1.3.0.linux-amd64.tar.gz
$ mv elasticsearch_exporter-1.3.0.linux-amd64/ elasticsearch_exporter
$ cd elasticsearch_exporter/
运行elasticsearch_exporter:
$ nohup ./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.20.30.40:9200 &xelasticsearch_exporter
查看输出日志:
$ tailf nohup.out
看指标信息:
$ curl "http://10.20.30.40:9114/metrics"
2.在Prometheus配置文件中加入新的job_name,写elasticsearch_exporter暴露指标的ip端口:
添加job_name部分:
$ cat prometheus.yml
- job_name: "elasticsearch_exporter"
static_configs:
- targets: ["10.20.30.40:9114"]
重启prometheus:
$ systemctl restart prometheus.service
3.在 Prometheus Web 查看监控抓取目标,抓取成功:
4.grafana确认已添加prometheus数据源
5. 在grafana Web 上导入仪表盘id为2322,选择prometheus数据源,在该仪表盘里可看到监控elasticsearch集群指标的完整信息。