部署Grafana+Prometheus+Exporter
Grafana
1 | docker run -d --name=grafana --network host grafana/grafana-enterprise |
Prometheus
下载并解压
1 | wget https://github.com/prometheus/prometheus/releases/download/v2.42.0/prometheus-2.42.0.linux-amd64.tar.gz |
给 prometheus 配置 systemd 启动,默认运行端口为 9090
1 | vim /usr/lib/systemd/system/prometheus.service |
Node Exporter
下载并解压
1 | wget https://github.com/prometheus/node_exporter/releases/download/v1.5.0/node_exporter-1.5.0.linux-amd64.tar.gz |
给 node_exporter 配置 systemd 启动,默认运行端口为 9100
1 | vim /usr/lib/systemd/system/node_exporter.service |
在 prometheus.yml 文件中追加监控 node_exporter 的配置
1 | vim /home/fengye/prometheus/prometheus-2.42.0.linux-amd64/prometheus.yml |
重启 prometheus
1 | systemctl restart prometheus |
MySQL Exporter
下载并解压
1 | wget https://github.com/prometheus/mysqld_exporter/releases/download/v0.14.0/mysqld_exporter-0.14.0.linux-amd64.tar.gz |
在 MySQL 中创建新用户(注意,必须创建新用户,不能直接用 root 用户,否则获取不到数据)
1 | CREATE USER 'mysqld_exporter'@'localhost' IDENTIFIED BY 'mysqld_exporter' |
创建配置文件
1 | vim /home/fengye/mysql_exporter/mysqld_exporter-0.14.0.linux-amd64/my.cnf |
给 mysql_exporter 配置 systemd 启动,默认运行端口为 9104
1 | vim /usr/lib/systemd/system/mysql_exporter.service |
在 prometheus.yml 文件中追加监控 mysql_exporter 的配置
1 | vim /home/fengye/prometheus/prometheus-2.42.0.linux-amd64/prometheus.yml |
重启 prometheus
1 | systemctl restart prometheus |
RocketMQ Exporter
下载并解压
1 | wget |
All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.