https://github.com/danielqsj/kafka_exporter/releases
tar -zxvf kafka_exporter-1.7.0.linux-amd64.tar.gz
mv kafka_exporter-1.7.0.linux-amd64 kafka_exporter
cd /usr/lib/systemd/system
vi kafka_exporter.service
内容如下
[Unit]
Description=https://prometheus.io
[Service]
Restart=on-failure
ExecStart=/data/prometheus/kafka_exporter/kafka_exporter --kafka.server=10.10.33.31:9092
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start kafka_exporter
查看服务状态
systemctl status kafka_exporter
配置开机自启
systemctl enable kafka_exporter
curl localhost:9308/metrics
修改Prometheus配置文件
vi prometheus.yml
添加如下内容
- job_name: kafka-pro
static_configs:
- targets: ['10.10.33.12:9308']
labels:
instance: kafka-pro'
刷新prometheus配置
curl -XPOST localhost:9090/-/reload
打开prometheus,可以在targets中看到刚配置的kafka-pro
Grafana配置
参考 Prometheus配置Grafana监控大屏