You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过CLI重置处于Fired状态的警报监控条件

通过CLI重置已触发警报的监控状态

针对Prometheus Alertmanager的操作步骤

如果你的警报基于Prometheus Alertmanager,可通过官方CLI工具amtool完成状态重置:

  • 安装并配置amtool
    先确保已安装amtool(可从Alertmanager官方发布包获取,或通过系统包管理器安装),然后创建配置文件~/.config/amtool/config.yml,指定Alertmanager的访问地址:

    alertmanager.url: http://<你的Alertmanager地址>:9093
    
  • 确认目标警报
    列出当前处于Fired状态的所有警报,定位你要重置的警报名称:

    amtool alert query state=Fired
    
  • 重置警报状态
    你可以创建静默规则让警报暂时退出Fired状态,命令格式如下:

    amtool silence add alertname="<目标警报名称>" --duration 1h
    

    该命令会创建持续1小时的静默,期间警报不会触发通知,状态变为Silenced。若需永久静默(直到手动取消),可去掉--duration参数。

    若要彻底清除当前触发状态(让Alertmanager重新评估告警条件),也可直接调用API删除告警实例:

    curl -X POST http://<你的Alertmanager地址>:9093/api/v2/alerts/delete -d '[{"labels":{"alertname":"<目标警报名称>"}}]'
    

其他监控系统的参考

如果警报基于其他系统(如Grafana Alerting、Azure Monitor等),对应CLI命令会有差异:

  • Grafana:使用grafana-cli alerts相关命令,需先配置API密钥
  • Azure Monitor:使用az monitor alert update或az monitor alert processing-rule命令调整警报状态

内容的提问来源于stack exchange,提问作者Parth Sekar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 10:53:09