1、部署zookeeper_exporter
#1、下载zookeeper_exporter,是一个二进制文件
wget https://github.com/carlpett/zookeeper_exporter/releases/download/v1.0.2/zookeeper_exporter && chmod +x zookeeper_exporter
#2、创建文件所在的目录
mkdir -p /usr/local/zookeeper_exporter/
mv zookeeper_exporter /usr/local/zookeeper_exporter/
#3、把zookeeper_exporter添加到系统服务
vi /etc/systemd/system/zook_exporter.service
[Unit]
Description=zook_exporter
Documentation=https://github.com/carlpett/zookeeper_exporter
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/zookeeper_exporter/zookeeper_exporter
Restart=on-failure
[Install]
WantedBy=multi-user.target
#4、启动服务并加入开机自启
systemctl daemon-reload
systemctl enable zook_exporter
systemctl start zook_exporter
#5、添加prometheus配置
- job_name: 'zookeeper_exporter'
static_configs:
- targets: ['10.4.62.33:9141']
labels:
instance: Zookeeper
#6、重启prometheus
systemctl restart prometheus