关于zookeeper:配置zookeeperexporter监控zookeeper

35次阅读

共计 1381 个字符,预计需要花费 4 分钟才能阅读完成。

1 装置 zookeeper_exporter 监控

目前 promethus 中没有开发有现成的 zookeeper 插件,所以抉择 github 中验证的 zookeeper 插件

l exporter 下载地址:https://github.com/carlpett/zookeeper_exporter/releases/download/v1.0.2/zookeeper_exporter

  • 下载后上传至 /usr/local/prometheus 目录下,没有能够本人建任意目录(留神上面配置到该目录即可)
  • 赋予执行权限

chmod 755 zookeeper_exporter

  • 查看帮忙:./zookeeper_exporter -h

2 启动 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_exporter -zookeeper yourIP:2181 -bind-addr :9143

Restart=on-failure

[Install]
WantedBy=multi-user.target
  • 将 zookeeper_exporter 服务设为开机自启并启动

systemctl daemon-reload

systemctl enable prometheus-zookeeper.service

systemctl start prometheus-zookeeper.service

3 配置 zookeeper_exporter

· 装置好 zookeeper _exporter 后,咱们须要在 Prometheus 中对其进行集成
· 批改 Prometheus 的配置文件 (prometheus.yml),增加 redis 服务 (在 scrape_configs 属性下增加)
cd /usr/local/prometheus/prometheus-2.15.2.linux-amd64
vim prometheus.yml

scrape_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

:wq

· 重启 prometheus 服务

systemctl restart prometheus.service

· 查看 Prometheus 服务 (默认端口为: 9090)

如上所示,当 State 状态显示为 UP 时,则阐明 zookeeper_exporter 服务曾经集成进来了

正文完
 0