使用prometheus监控elasticsearch集群
2019-06-25 本文已影响3人
baiyongjie
下载对于版本插件
github地址: https://github.com/vvanholl/elasticsearch-prometheus-exporter
我这里是使用6.6.2版本,考虑到部分同学访问不到github,已下载到个人站点供下载
cd /data/elasticsearch-6.6.2/
wget http://download.baiyongjie.com/linux/prometheus/prometheus-exporter-6.6.2.0.zip
启动插件
$ /data/elasticsearch-6.6.2/bin/elasticsearch-plugin install file:///data/elasticsearch-6.6.2/prometheus-exporter-6.6.2.0.zip
-> Downloading file:///data/elasticsearch-6.6.2/prometheus-exporter-6.6.2.0.zip
[=================================================] 100%
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission accessClassInPackage.sun.misc
* java.lang.RuntimePermission accessDeclaredMembers
* java.lang.reflect.ReflectPermission suppressAccessChecks
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.
Continue with installation? [y/N]y
-> Installed prometheus-exporter
启动es
/data/elasticsearch-6.6.2/bin/elasticsearch -d
配置Prometheus
# cat prometheus.yml
- job_name: 'elasticsearch'
metrics_path: "/_prometheus/metrics"
file_sd_configs:
- files: ['/opt/prometheus/sd_config/elasticsearch.yml']
refresh_interval: 180s
# ./promtool check config prometheus.yml
Checking prometheus.yml
SUCCESS: 3 rule files found
Checking rules/kuberneteus.yml
SUCCESS: 19 rules found
# cat sd_config/elasticsearch.yml
- targets:
- 192.168.1.73:19200
- 192.168.1.74:19200
- 192.168.1.212:19200
labels:
service: elasticsearch
cluster: dlink-uat
[root@localhost prometheus]# curl -s 192.168.1.73:19200/_prometheus/metrics|grep ^es_cluster_status
es_cluster_status{cluster="Dlink-es-cluster",} 0.0
[root@localhost prometheus]# curl -s 192.168.1.74:19200/_prometheus/metrics|grep ^es_cluster_status
es_cluster_status{cluster="Dlink-es-cluster",} 0.0
[root@localhost prometheus]# curl -s 192.168.1.212:19200/_prometheus/metrics|grep ^es_cluster_status
es_cluster_status{cluster="Dlink-es-cluster",} 0.0
配置grafana
导入模板
- 266