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、查看钉钉告警

相关推荐
无足鸟ICT1 小时前
【RHCA+】_proc_pid_task_
linux·运维·服务器
weixin_404679313 小时前
cc 在 linux 安装
linux·运维·服务器
云上工程笔记4 小时前
大模型平台私有化部署怎么选?2026年合规要求、运维难度与架构成本评测
运维·架构
vivo互联网技术6 小时前
春节流量洪峰下的运维组织战:SRE 团队的春节保障实录
运维·运维开发·sre·组织协同
重生之小比特6 小时前
【Linux系统】22 线程概念与控制(上)
linux·运维
wno7047 小时前
Nginx代理MySQL或PG连接
运维·mysql·nginx
FriendshipT7 小时前
YOLOE Docker 部署实战:三模式推理、掩码输出与跨图视觉的完整实现
运维·人工智能·python·深度学习·docker·容器
如夏倾城7 小时前
NGFW ( Next-Generation Firewall,下一代防火墙)
运维·服务器·网络·http·网络安全·ssl·信息与通信
鲁邦通物联网9 小时前
DNV新造船海事网关安全通信架构与系列船验证方法
运维·安全·海事网关·船用网关·海事网络安全·智慧航运·船用路由器