prometheus监控zookeeper

1.下载(zookeeper_exporter采集器)

https://github.com/carlpett/zookeeper_exporter/releases/download/v1.0.2/zookeeper_exporter

2. 传到liunx上/usr/local/prometheus目录下,没有目录可以自行创建

在这里插入图片描述

3.授予权限

chmod 755 zookeeper_exporter

4.查看帮助(如果提示没有权限,则执行 chmod 755 zookeeper_exporter进行授权)

./zookeeper_exporter -h

5.编写zookeeper_exporter监控脚本

vim /lib/systemd/system/prometheus-zookeeper.service
[Unit]
Description= prometheus-zookeeper
After=network.target

[Service]
Type=simple
ExecStart= /usr/local/prometheus/zookeeper_exporter -zookeeper yourIP:2181 -bind-addr :9143

Restart=on-failure

[Install]
WantedBy=multi-user.target

6.分别执行如下命令

重载配置
systemctl daemon-reload
设置开机启动
systemctl enable prometheus-zookeeper.service
启动zookeeper_exporter
systemctl start prometheus-zookeeper.service

systemctl status prometheus-zookeeper.service

7.查看zookeeper_exporter运行状态(如出现Active: active (running) 已经运行成功)
在这里插入图片描述

8.查看采集数据

curl localhost:9143/metrics

在这里插入图片描述

9.修改 Prometheus 的配置文件 (prometheus.yml)

crape_configs:

 # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.

 - job_name: 'prometheus'

 # metrics_path defaults to '/metrics'

 # scheme defaults to 'http'.

 static_configs:

 - targets: ['localhost:9090']

 - job_name: 'zookeeper'

 static_configs:

 - targets: ['YourIP:9143']

 labels:

 instance: zookeeper

10.重启Prometheus ,访问http://localhost:9090
如上所示,当 State 状态显示为 UP 时,则说明 zookeeper_exporter 服务已经集成进来了
参考:https://segmentfault.com/a/1190000039725616

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值