下载地址
https://github.com/danielqsj/kafka_exporter/releases
解压
tar -zxvf kafka_exporter-1.7.0.linux-amd64.tar.gzmv kafka_exporter-1.7.0.linux-amd64 kafka_exporter
服务配置
cd /usr/lib/systemd/systemvi 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-reloadsystemctl start kafka_exporter
查看服务状态
systemctl status kafka_exporter
配置开机自启
systemctl enable kafka_exporter
访问验证
curl localhost:9308/metrics
对接Prometheus
修改Prometheus配置文件
vi prometheus.yml
添加如下内容
- job_name: kafka-prostatic_configs:- targets: ['10.10.33.12:9308']labels:instance: kafka-pro'
刷新prometheus配置
curl -XPOST localhost:9090/-/reload
打开prometheus,可以在targets中看到刚配置的kafka-pro
Grafana配置
参考 Prometheus配置Grafana监控大屏