架构
1、下载grafana
grafana-enterprise-11.0.0.windows-amd64.msi
2、下载prometheus
prometheus-2.52.0.windows-amd64.zip
修改配置文件prometheus.yml,假定alertManager安装在本机
3、下载alertmanager
alertmanager-0.28.1.windows-amd64.zip
修改配置文件
# 分组后发送告警的时间间隔
group_interval: 5m
# 发送告警间隔时间 s/m/h,如果指定时间内没有修复,则重新发送告警
repeat_interval: 1h

修改prometheus.yml配置文件,增加alert配置,并在rules目录下增加报警规则配置文件disk_over.yml
alerting:
alertmanagers:
- static_configs:
- targets:
- localhost:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
- "rules\\*.yml"

4、安装prometheus+webhook+dingding插件
在https://github.com/timonwong/prometheus-webhook-dingtalk/releases下载
prometheus-webhook-dingtalk-2.1.0.windows-amd64.tar.gz
修改配置文件
这里webhook1的url使用钉钉机器人中配置的webhook url,在机器人配置中说明

5、配置钉钉机器人
群设置-添加机器人-自定义

机器人设置中copy webhook链接,写到
prometheus-webhook-dingtalk-2.1.0.windows-amd64的配置文件webhook1的url中

最后启动grafana prometheus alertmanager
prometheus-webhook-dingtalk插件,假定windows_exporter已安装在被检测机器且已启动
在grafana上显示

在prometheus上显示
在alertmanager上显示
在钉钉上显示
阅读(438) | 评论(0) | 转发(0) |