Chr*_*ill 3 prometheus cadvisor
我正在使用Prometheus,cAdvisor和Prometheus Alertmanager监控几个容器.我想要的是在容器出于某种原因出现故障时收到警报.问题是如果容器死了,cAdvisor没有收集任何指标.任何查询都返回"无数据",因为查询没有匹配项.
小智 6
看看没有普罗米修斯的功能()
如果传递给它的向量具有任何元素,则缺少(v instant-vector)返回空向量,如果传递给它的向量没有元素,则返回值为1的1元素向量.
这对于在给定度量标准名称和标签组合不存在时间序列时发出警报非常有用.
例子:
absent(nonexistent{job="myjob"}) => {job="myjob"}
absent(nonexistent{job="myjob",instance=~".*"}) => {job="myjob"}
absent(sum(nonexistent{job="myjob"})) => {}
这是警报的示例:
ALERT kibana_absent
IF absent(container_cpu_usage_seconds_total{com_docker_compose_service="kibana"})
FOR 5s
LABELS {
severity="page"
}
ANNOTATIONS {
SUMMARY= "Instance {{$labels.instance}} down",
DESCRIPTION= "Instance= {{$labels.instance}}, Service/Job ={{$labels.job}} is down for more than 5 sec."
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7874 次 |
| 最近记录: |