Prometheus + Grafana 实现钉钉报警
资源列表
操作系统 | 配置 | 主机名 | IP |
---|---|---|---|
CentOS 7.9 | 2C2G | prometheus | 192.168.10.192 |
CentOS 7.9 | 2C2G | grafana | 192.168.10.193 |
CentOS 7.9 | 2C2G | node | 192.168.10.194 |
CentOS 7.9 | 2C2G | alert | 192.168.10.195 |
- 所需安装包
Prometheus相关安装包都在github进行托管,而访问github时好时坏,
有条件的或使用GitHub镜像网站可以自行下载;没条件的可以通过下面链接进行下载:
Prometheus+Grafana.zip
https://url83.ctfile.com/f/33603683-606759914-012c3c?p=1942 (访问密码: 1942)
物料包
1 基础环境
- 关闭防火墙
systemctl stop firewalld && systemctl disable firewalld
- 关闭selinux
sed -i "s/^SELINUX=*/SELINUX=disabled/g" /etc/selinux/config
setenforce 0
- 修改主机名,添加hosts解析
cat << EOF >> /etc/hosts
192.168.10.192 prometheus
192.168.10.193 grafana
192.168.10.194 node
192.168.10.195 alert
EOF
# 修改主机名
hostnamectl set-hostname grafana && su
hostnamectl set-hostname node && su
hostnamectl set-hostname alert && su
hostnamectl set-hostname prometheus && su
- 时间同步
这里很重要
systemctl restart chronyd
chronyc sources
# 检查时间
date
2 Prometheus节点部署prometheus
- 上传prometheus源码包,并解压
tar zxf prometheus-2.26.0.linux-amd64.tar.gz
mv prometheus-2.26.0.linux-amd6