以下是一个示例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/eQ48 著作权归作者所有。请勿转载和采集!

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