以下是一个示例 PromQL 规则,用于判断数据库中是否存在名为 'my_alerts_total' 的指标:

ALERT MyAlertsTotalMissing
  IF absent(my_alerts_total) FOR 5m
  LABELS {
    severity = 'critical',
    alertname = 'MyAlertsTotalMissing'
  }
  ANNOTATIONS {
    summary = 'my_alerts_total is missing from the database',
    description = 'my_alerts_total should be present in the database but has not been found for the past 5 minutes.'
  }

该规则定义了一个名为 MyAlertsTotalMissing 的警报,它使用 PromQL 函数 absent() 来检查 'my_alerts_total' 是否不存在。如果 'my_alerts_total' 在过去的 5 分钟内未出现,则会触发警报。警报的标签和注释提供了有用的信息,以便在警报发生时快速识别问题并采取行动。

PromQL 规则:判断数据库是否存在指标 'my_alerts_total'

原文地址: https://www.cveoy.top/t/topic/nZBm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录