gaoshaofei

导航

 

Prometheus监控ES集群

在配置前检查es集群状态是否存活
[root@elk1 ~]# curl -u elastic:123456 http://10.0.0.91:9200/_cat/nodes
10.0.0.91 43 95 0 0.39 0.30 0.27 cdfhilmrstw * elk1
10.0.0.92 27 96 0 0.49 0.38 0.26 cdfhilmrstw - elk2
10.0.0.93 33 97 1 0.33 0.31 0.26 cdfhilmrstw - elk3
这里我的集群测试 就没有加密 如果加密集群的话需要配置证书验证 或者使用-k参数来跳过验证
1.下载es exporter在客户端(监控的主机)
wget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.9.0/elasticsearch_exporter-1.9.0.linux-amd64.tar.gz




##### 2.解压特定的程序

```bash
[root@elk1 ~]# tar xf elasticsearch_exporter-1.9.0.linux-amd64.tar.gz -C /usr/local/bin/ elasticsearch_exporter-1.9.0.linux-amd64/elasticsearch_exporter   --strip-components=1
3.启动es exporter
[root@elk1 ~]# elasticsearch_exporter --es.uri="https://elastic:123456@10.0.0.91:9200"  --es.ssl-skip-verify
ps:查看监听端口
4.访问测试es exporter的WebUI
http://10.0.0.91:9114/metrics

ps:集群的话就是将配置文件copy到对应节点 然后在服务端添加对应的主机信息就行
5.Prometheus配置监控es-exporter(添加架空主机信息)
[root@prometheus-server31 ~]# tail -5  /gsf/softwares/prometheus-2.53.4.linux-amd64/prometheus.yml
  - job_name: es-exporter
    static_configs:
    - targets: 
      - 10.0.0.41:9114
        
        
文件末尾添加注意yml格式!!!

修改完成后需要热加载
[root@prometheus-server31 ~]# curl -X POST http://10.0.0.31:9090/-/reload
6.验证Prometheus配置是否生效
http://10.0.0.31:9090/targets?search=
7.grafana导入模板ID
添加数据源
这里先推荐两个比较实用的模板,因为不太会写PromQL查询语句!
14191
9746
posted on 2025-04-05 20:42  不懂运维的小高  阅读(31)  评论(0)    收藏  举报