@rickyChen
2017-08-02T18:40:40.000000Z
字数 491
阅读 2392
Python
Prometheus
项目源码github
下载项目并解压
pip install -r requirements.txt
vim cluster.conf
# 集群别名
[kafka1003]
# zookeeper地址
zk = 127.0.0.1:2128/kafka1003
# kafka集群,多个节点用逗号','隔开
brokers = broker1,broker2
python logsize_exporter.py
运行脚本即可通过flask
启动一个web服务器
访问hostname:8082/metrics即可获取到相关数据
在Prometheus中新建一个任务
scrape_configs:
- job_name: "Kafka_LogSize"
static_configs:
- targets:
- hostname:8082
scrape_interval: 20s
scrape_timeout: 10s