栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Prometheus监控 mysql、redis、kafka、elasticsearch

Prometheus监控 mysql、redis、kafka、elasticsearch

Prometheus监控实战篇 一、Prometheus安装

下载地址:
官方地址:
安装步骤:

1.下载Prometheus,我用的是2.32.1版本,需要其他版本可以去官方下载

wget https://github.com/prometheus/prometheus/releases/download/v2.32.1/prometheus-2.32.1.linux-amd64.tar.gz

2.解压

tar xf  prometheus-2.32.1.linux-amd64.tar.gz


3. 启动

./prometheus --help  # 命令帮助,可以根据自己的实际情况操作
nohup ./prometheus --web.listen-address=:9191 &>/opt/prometheus_servicer/log/prometheus_server.log &
二、Prometheus监控mysql

mysql_exporter下载地址
1.解压,并进入解压目录

tar xf mysqld_exporter-0.13.0.linux-amd64.tar.gz

2.数据库创建用户并授权

# 创建用户
CREATE USER 'exporter'@'localhost' IDENTIFIED BY '111111';
# 授权
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'exporter'@'localhost';

3.进入mysqld_exporter创建mysql配置文件

vim mysqld_exporter/.my.cnf
[client]
user=exporter
password=111111

4. 启动mysqld_exporter 默认端口9104

nohup ./mysqld_exporter --config.my-cnf=.my.cnf &

5.在Prometheus添加mysql监控节点

vim prometheus-2.32.1.linux-amd64/prometheus.yml
  - job_name: "mysql_exporter"
    static_configs:
      - targets: ["localhost:9104"]


6. 重新启动Prometheus

1. 先kill掉进程,然后执行下边启动命令
nohup ./prometheus --web.listen-address=:9191 &>/opt/prometheus_servicer/log/prometheus_server.log &



7. 在granfan中添加模版( 我使用的是7362模板 )

这边报错, 是因为我已经有这个模版了
数据展示

三、Prometheus监控redis

redis_exporter下载地址:
1.解压

tar xf redis_exporter-v1.3.5.linux-amd64.tar.gz

2.启动redis_exporter

nohup ./redis_exporter -redis.addr xxxIP地址xx:6379  -redis.password iotplatform &

3.在Prometheus中添加redis监控节点

vim Prometheus.yml
  - job_name: "redis_exporter"
    static_configs:
      - targets: ["localhost:9121"]


4.重新启动Prometheus

1. 先kill掉进程,然后执行下边启动命令
nohup ./prometheus --web.listen-address=:9191 &>/opt/prometheus_servicer/log/prometheus_server.log &

5.在granfan添加redis模块


数据展示

四、Prometheus监控kafka

kafka_exporter下载地址:
1.解压
2.启动kafka_exporter

nohup  ./kafka_exporter --kafka.server=IP地址:9092 &

3.在Prometheus中添加配置

vim prometheus.yml
  - job_name: "kafka_exporter"
    static_configs:
      - targets: ["localhost:9308"]


4. 重启Prometheus

1. 先kill掉进程,然后执行下边启动命令
nohup ./prometheus --web.listen-address=:9191 &>/opt/prometheus_servicer/log/prometheus_server.log &

5.在granfan中添加kafka模块( 使用的7589模块 )

数据展示

五、Prometheus监控elasticsearch

elasticsearch_exporter下载地址
1.解压
2.启动elasticsearch_exporter

nohup ./elasticsearch_exporter --web.listen-address ":9309"  --es.uri http://IP地址:9200 &

3.在Prometheus添加配置

vim Prometheus.yml
  - job_name: "elasticsearch_exporter"
    static_configs:
      - targets: ["localhost:9309"]


4.重启Prometheus

1. 先kill掉进程,然后执行下边启动命令
nohup ./prometheus --web.listen-address=:9191 &>/opt/prometheus_servicer/log/prometheus_server.log &

5.在granfan中添加模块(使用模块2322)

数据展示

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/735075.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号