我想使用模板来使警报更易于阅读。 基本上,我有这样的警报:
alertname =“ service_1的dvvmclust1上部署了3个容器(每个节点预期1个)”
... 08:53:46,2018-11-12
...标签
.......严重性=“严重”
....... node_name =“ dvvmclust1”
....... monitor =“ docker-swarm-host”
....... com_docker_swarm_service_name =“ qgis”
希望通过这种方式定义Il:
#include <stdio.h>
int main(void) {
int A[2][3] = {};
int B[3][2] = {};
int i,j;
for(i=0; i < 2;i++) {
for(j=0; j < 3;j++) {
scanf(" %d\n", &A[i][j]);
getchar();
}
}
return 0;
}
我想我知道只要我不使用“ relabel_configs”这样的方式,这些标签就不会在“ .labels”表中显示:
alert: ${{ labels.com_docker_swarm_service_name }} has ${{ value }} containers deployed over ${{ labels.node_name }} (1 expected per node)
expr: whatever > 1
for: 30m
labels:
severity: critical
annotations:
description: ${{ labels.com_docker_swarm_service_name }} has ${{ value }} containers deployed over ${{ labels.node_name }}. You are not expected to have more that 1 at once per node. Please consider redeploying the service among the available nodes or restarting failed nodes.
summary: ${{ labels.com_docker_swarm_service_name }} has ${{ value }} containers deployed over ${{ labels.node_name }} (1 expected per node)
尽管,当我从Prometheus API中查看服务发现时,虽然从( eg < / em>)cAdvisor指标:
relabel_configs
- source_labels: [__com_docker_swarm_service_name__]
target_label: __com_docker_swarm_service_name
(我从docker-compose文件中添加了一些标签)
所以我的问题是:如何通过cAdvisor或node_exporter从容器中驱动标签(及其“相关名称!”),例如“ serviceName”和“ nodeName”,直到在prometheus中定义了非常警报的状态? / p>