相关博文原文地址:

51CTO博客:sqtce:Prometheus+Grafana+kafka_exporter搭建监控系统监控kafka



一、Prometheus+Grafana+kafka_exporter搭建监控系统监控kafka

1.1Kafka_exporter安装

#下载tar包
wget https://github.com/danielqsj/kafka_exporter/releases/download/v1.2.0/kafka_exporter-1.2.0.linux-amd64.tar.gz

#解压
tar -zxvf kafka_exporter-1.2.0.linux-amd64.tar.gz

进入到kafka_exporter目录,启动kafka监控端口:

cd kafka_exporter-1.2.0.linux-amd64

./kafka_exporter --kafka.server=kafkaIP或者域名:9092 & 

1.2配置prometheus

进入到Prometheus目录文件下,配置prometheus.yml。

vim /prometheus/prometheus.yml

配置:

scrape_configs:
   - job_name: 'prometheus'
     static_configs:
      - targets: ['localhost:9090'] 
  - job_name: 'kafka'
     static_configs:
      - targets: ['kafkaIP或者域名:9308']
        labels:
          instance: kafka@kafkaIP或者域名

或者配置:

scrape_configs:
   - job_name: 'prometheus'
     static_configs:
      - targets: ['localhost:9090'] 
  - job_name: 'kafka'
     static_configs:
      - targets: ['slave1:9308','salve2:9308','slave3:9308']

重启prometheus。

./prometheus

#后台启动
nobup ./prometheus

如果是采用docker发布的,则

docker restart prometheus

1.3Prometheus浏览器查看状态

通过浏览器访问:http://prometheus服务器IP:9090,所添加的kafka_exporter状态为UP,就可以去配置grafana。

Prometheus+Grafana+kafka_exporter监控kafka_Prometheus

1.4配置grafana

通过浏览器访问:http://grafana服务器IP:3000。

添加数据源,选择prometheus,填入prometheus服务器IP端口,点击保存。

Prometheus+Grafana+kafka_exporter监控kafka_Prometheus_02

Prometheus+Grafana+kafka_exporter监控kafka_Prometheus_03

Prometheus+Grafana+kafka_exporter监控kafka_Prometheus_04

图表数据:
Prometheus+Grafana+kafka_exporter监控kafka_Prometheus_05

二、其他搭建相关博文

CSDN:bill_xiang:prometheus+grafana监控kafka

CSDN:Quincy379:Prometheus+Grafana监控系统通过kafka_exporter监控kafka