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

相关推荐
蝎子莱莱爱打怪3 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
DianSan_ERP4 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅4 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒4 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
zhangfeng11334 天前
趋动云 如何ssh登录 服务区 项目server
运维·人工智能·ssh
ZeroNews内网穿透4 天前
谷歌封杀OpenClaw背后:本地部署或是出路
运维·服务器·数据库·安全
失重外太空啦4 天前
nginx
运维·nginx
Gofarlic_oms14 天前
避免Kisssoft高级分析模块过度采购的科学评估方法
大数据·linux·运维·人工智能·matlab
田井中律.4 天前
服务器部署问题汇总(ubuntu24.04.3)
运维·服务器
大大水瓶4 天前
HAProxy 从入门到实战:负载均衡与流量管理全解析
运维·负载均衡