vmalert集成钉钉告警

vmalert通过在alert.rules中配置告警规则实现告警,告警规则语法与Prometheus兼容,依赖Alertmanager与prometheus-webhook-dingtalk实现钉钉告警,以下步骤:

1、构建vmalert

从源代码构建vmalert:

复制代码
git clone https://github.com/VictoriaMetrics/VictoriaMetrics
cd VictoriaMetrics
make vmalert

构建二进制文件将放置在VictoriaMetrics/bin文件夹中。

2、添加alert.rules

告警规则语法兼容Prometheus:

复制代码
vim alert.rules

#rule示例
groups:
    - name: test-rule
      rules:
      - alert: 主机状态
        expr: up == 0
        for: 2m
        labels:
          status: warning
        annotations:
          summary: "{{$labels.instance}}:服务器关闭"
          description: "{{$labels.instance}}:服务器关闭"

3、修改钉钉prometheus-webhook-dingtalk配置文件

复制代码
vim /usr/local/prometheus-webhook-dingtalk/config.example.yml

4、修改alertmanager配置文件

复制代码
#查看prometheus-webhook-dingtalk的url地址,altermanager会将通知像这个地址发送
journalctl -u prometheus-webhook-dingtalk -f

#可以看到url    urls=http://localhost:8060/dingtalk/webhook1/send

vim /usr/local/alertmanager/alertmanager.yml

5、启动vmalert

复制代码
./bin/vmalert -rule=alert.rules \
  -datasource.url=http://localhost:8428 \
  -notifier.url=http://localhost:9093 &

6、查看钉钉告警

相关推荐
Guheyunyi3 小时前
用电安全管理系统的三大系统架构
大数据·运维·人工智能·安全·架构·系统架构
weixin_307779133 小时前
Jenkins Pipeline: Multibranch 插件详解:现代CI/CD的多分支管理利器
运维·开发语言·自动化·jenkins·etl
刀刀是个萌妹子3 小时前
使用CloneZilla还原操作系统
linux·运维·服务器
代码不行的搬运工3 小时前
交换机和网卡的 PFC 机制工作原理与实例解析
运维·服务器·网络·算力网络
二狗哈3 小时前
Cesium快速入门22:fabric自定义着色器
运维·开发语言·前端·webgl·fabric·cesium·着色器
Kristen_YXQDN3 小时前
PyCharm 中 pytest 运行 python 测试文件报错:D:\Python_file\.venv\Scripts\python.exe: No module named pytest
运维·开发语言·python·pycharm·pytest
eddy-原3 小时前
全链路 DevOps 实战:基于 Jenkins、GitLab、Prometheus 与 SonarQube 的持续集成、部署、监控与优化
运维·jenkins
尾张大4 小时前
ubuntu AWS 磁盘扩容
运维·aws
云飞云共享云桌面4 小时前
云飞云智能共享云桌面:企业PLM/ERP/MES等系统管理的革新方案
运维·服务器·网络·算法·性能优化
weixin_307779134 小时前
Jenkins Folders插件详解:组织、管理与最佳实践
运维·开发语言·自动化·jenkins