使用prometheus监控elasticsearch集群

下载对于版本插件

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
11123.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文章目的: 1、向没听过或者刚听过但是还对这个监控系统没有任何概念的开发者介绍Prometheus的应用场景。2、...
    whaike阅读 39,708评论 15 59
  • 介绍部署方式的文档很多,这里就不多做介绍了,更多的本次部署的经验教训,框架的模式等的总结。 公司需要发...
    怕水河马阅读 6,930评论 1 1
  • Prometheus对比Zabbix 和Zabbix类似,Prometheus也是一个近年比较火的开源监控框架,和...
    Cloudox_阅读 43,891评论 0 49
  • 若雪变得没有理智,漫无目的离开医院,回到属于他们的小屋,床,桌子,椅子,房子,秋千,薰衣草,一切都还在,还留有炫的...
    一心小记阅读 297评论 0 3
  • 默契于“成德之教”,实乃人生之一大快! 豁然挣脱一切可怕的、拘束的、压抑的、紧绷的枷锁藩篱,目见人生能由此毅然地、...
    静客_阅读 427评论 0 0