[TOC]
prometheus
上传prometheus
安装包至lab3
服务器/opt/modules/
目录下并解压
tar -zxf prometheus-2.32.1.linux-amd64.tar.gz
进入/opt/modules/prometheus-2.32.1
目录,修改prometheus.yml
文件
vi prometheus.yml
将配置信息做如下修改
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["lab3:9090"]
- job_name: "node exporter"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['lab1:8100', 'lab2:8100', 'lab3:8100']
- job_name: "kafka exporter"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['lab3:9308']
在/opt/modules/prometheus-2.32.1
目录下启动prometheus
nohup ./prometheus --config.file=prometheus.yml > ./prometheus.log 2>&1 &
查看9090
端口状态或浏览器访问http://lab3:9090
验证是否成功
lsof -i:9090
node_exporter
上传node_exporter
安装包至lab3
服务器/opt/modules/
目录下并解压
tar -zxf node_exporter-1.3.1.linux-amd64.tar.gz
进入/opt/modules/node_exporter-1.3.1
目录,启动node_exporter
nohup ./node_exporter --web.listen-address=:8100 &
查看8100
端口状态或浏览器访问http://lab3:8100/metrics
验证是否成功
lsof -i:8100
在lab1
和lab2
上重复上述步骤
kafka_exporter
上传kafka_exporter
安装包至lab3
服务器/opt/modules/
目录下并解压
tar -zxf kafka_exporter-1.4.2.linux-amd64.tar.gz
进入/opt/modules/kafka_exporter-1.4.2
目录,启动kafka_exporter
nohup ./kafka_exporter --kafka.server=lab3:9092 > kafka_exporter.log --web.listen-address=:9308 &
查看9308
端口状态或浏览器访问http://lab3:9308/metrics
验证是否成功
lsof -i:9308
grafana
上传grafana
至lab3
服务器/opt/modules/
目录
进入/opt/modules/grafana-8.3.4
目录,启动grafana
nohup ./bin/grafana-server web > ./grafana.log 2>&1 &
查看3000
端口状态或浏览器访问http://lab3:3000/
验证是否成功
lsof -i:3000
访问http://lab3:3000
, 用户和密码均为admin
进入左侧设置,配置prometheus
数据源及mysql
数据源
软件 | 版本 | 安装位置 |
---|---|---|
prometheus | 2.32.1 | lab3 |
node_exporter | 1.3.1 | lab1,lab2,lab3 |
kafka_exporter | 1.4.2 | lab3 |
grafana | 8.3.4 | lab3 |