prometheus 自监控服务
一:Prometheus job missing
监控prometheus 自我存在性的服务
- alert: PrometheusJobMissing expr: absent(up{job="prometheus"}) for: 0m labels: severity: warning annotations: summary: Prometheus job missing (instance {{ $labels.instance }}) description: "A Prometheus job has disappeared\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"expr: absent(up{job="prometheus"})
表达式说明:
expr: 计算开始
absent() : 判断是否存在,返回0 或1 ,true 或false
up: 判断是否存在,返回0 或1
{job="prometheus"} 是Prometheus.yaml 中的一个采集作业点
整体意义是,判断job prometheus自身是否存在
up{job="prometheus"} = 0,表示prometheus不存在
up{job="prometheus"} = 1,表示prometheus存在
absent(up{job="prometheus"}) = 0,表示prometheus 存在,即正常
absent(up{job="prometheus"}) = 1 表示prometheus 不存在,即prometheus不正常,需要关注告警并处理