资源规划
组件 | bigdata-node1 | bigdata-node2 | bigdata-node3 |
---|---|---|---|
OS | centos7.6 | centos7.6 | centos7.6 |
Prometheus | Prometheus | N.A | N.A |
安装介质
版本:prometheus-2.10.0.linux-amd64.tar.gz
下载:https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
安装Prometheus
解压缩
sudo su
cd /share
# 下载安装介质
wget https://github.com/prometheus/prometheus/releases/download/v2.10.0/prometheus-2.10.0.linux-amd64.tar.gz
tar -zxvf /share/prometheus-2.10.0.linux-amd64.tar.gz
rm -rf /share/prometheus-2.10.0.linux-amd64.tar.gz
rm -rf /usr/local/prometheus
mv /share/prometheus-2.10.0.linux-amd64 /usr/local/prometheus
创建相关目录
mkdir -p /usr/local/prometheus/data
创建用户并授权
useradd prometheus
chown -R prometheus:prometheus /usr/local/prometheus
启动服务配置
rm -rf /usr/lib/systemd/system/prometheus.service
vi /usr/lib/systemd/system/prometheus.service
配置如下:
[Unit]
Description=Prometheus
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/usr/local/prometheus/data --web.enable-admin-api
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
- 参数说明
—web.enable-admin-api:开启Prometheus API功能
启动
systemctl daemon-reload
systemctl enable prometheus.service
systemctl start prometheus.service
systemctl stop prometheus.service
验证
systemctl status prometheus.service
ps -ef | grep prometheus
# 端口查看
netstat -anpt
Web UI:http://bigdata-node1:9090
组件安装
1. 探针安装
- Prometheus-Consul_exporter
- Prometheus-Kafka_exporter
- Prometheus-MySQL_exporter
- Prometheus-Node_exporter
- Prometheus-Process_exporter
- Prometheus-Redis_exporter
-
2. Pushgateway安装
-
参考
CSDN:CentOS7下部署Prometheus+Grafana+node_exporter监控并报警到钉钉&邮件
https://blog.csdn.net/yaodunlin/article/details/89159500