PrometheusAlert 是国人开发的,为国人量身打造的一个开源项目,感觉好用,请去点个star(非利益相关,实话实说)。它集成了常见的告警方式,支持钉钉、企业微信、阿里云、腾讯云、华为云等、短信、邮件等告警。
安装简要流程梳理
# 安装过程简要说明
git clone https://github.com/feiyu563/PrometheusAlert.git
mv PrometheusAlert /usr/local/
chmod 755 /usr/local/PrometheusAlert/example/linux/PrometheusAlert
cat > /usr/lib/systemd/system/PrometheusAlert.service << EOF
[Unit]
Description=PrometheusAlert
After=network.target
[Service]
Restart=on-failure
WorkingDirectory=/usr/local/PrometheusAlert
ExecStart=/usr/local/PrometheusAlert/example/linux/PrometheusAlert
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable PrometheusAlert.service
暂时不启动PrometheusAlert
配置nginx 访问
cat > prometheus_alert.conf << EOF
server {
listen 80;
server_name alert.aaaa.com;
location / {
auth_basic "Alert Auth";
auth_basic_user_file /usr/local/nginx/prometheus.passwd;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://172.19.120.164:8080;
}
access_log /usr/local/nginx/logs/alert.log main;
}
EOF