Prometheus安装:
步骤一:解压安装包
tar -zxvf prometheus-2.30.0.linux-amd64.tar.gz
步骤二:修改文件名称移到指定的目录下
mv prometheus-2.30.0.linux-amd64 /usr/local/prometheus
步骤三:将prometheus做成服务
cat > /etc/systemd/system/prometheus.service <<EOF
[Unit]
Description=Prometheus
Documentation=Prometheus
[Service]
ExecStart=/usr/local/prometheus/prometheus --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus --web.enable-lifecycle --storage.tsdb.retention.time=180d
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
步骤四:启动服务 默认端口9090
systemctl start prometheus
步骤五:设置开机自启
systemctl enable prometheus
Grafana安装:
步骤一:
yum localinstall -y grafana-6.7.3-1.x86_64.rpm
步骤二:
systemctl daemon-reload
步骤三:启动服务 默认端口3000 默认账号密码:admin,admin
systemctl start grafana-server
步骤四:设置开机自启
systemctl enable grafana-server
Node_export安装:
步骤一:
tar -xvf node_exporter-1.2.2.linux-amd64.tar.gz
步骤二:
mv node_exporter-1.2.2.linux-amd64 /usr/local/node_exporter
步骤三: 默认端口9100
cd /usr/local/node_exporter 执行 ./node_exporter
Grafana整合Prometheus操作:修改prometheus.yml
重启Prometheus: systemctl restart prometheus
Grafana配置数据源
Grafana的dashboard配置:
官网查找对应dashboard模板进行load操作,比如8919,mysql的是7362