[英]How to differentiate alert rules in Prometheus if there are multiple exporter
I want to monitor docker containers running on multiple servers lets say i have a,b servers and containers running inside them, now I add one server (d) I want to monitor all docker containers inside all servers (A,B) only from server c.我想监控在多台服务器上运行的 docker 容器假设我有 a、b 服务器和容器在其中运行,现在我添加一台服务器 (d) 我想监控所有服务器 (A,B) 内的所有 docker 容器仅从服务器c。 I have configured the docker to expose logs on all servers followed this docker docs not using cAdvisor.
我已将 docker 配置为在所有服务器上公开日志,遵循此docker 文档而不使用 cAdvisor。 The target status shows 'ok' on all the servers, but the problem is as expression is same for all the containers of docker Prometheus is not able differentiate between the servers can anyone share the sample Prometheus rule file with expression ie number of stopped containers should not be less then x.This is my current rule file
目标状态在所有服务器上显示“正常”,但问题是 docker 的所有容器的表达式都相同 Prometheus 无法区分服务器 任何人都可以使用表达式共享示例 Prometheus 规则文件,即停止容器的数量应该不小于 x。这是我当前的规则文件
groups:
- name: Server_A
rules:
- alert: Central_service_down
expr: engine_daemon_container_states_containers{state="running"} < 10
for: 50s
labels:
severity: critical
instance: <IP_of_A>:9323
annotations:
summary: "Monitor service non-operational"
description: "Demo Service {{ $labels.instance }} is down."
- name: Server_B
rules:
- alert: Central_service_down
expr: engine_daemon_container_states_containers{state="running"} < 10
for: 50s
labels:
severity: critical
instance: <IP_of_B>:9323
annotations:
summary: "Monitor service non-operational"
description: "Demo Service {{ $labels.instance }} is down."
as u can see expr: engine_daemon_container_states_containers{state="running"} < 10
is same for both server a and b how can i differentiate expr for both.如您所见,
expr: engine_daemon_container_states_containers{state="running"} < 10
对于服务器 a 和 b 是相同的,我如何区分两者的 expr。 please share sample alert file.Thanks in advance请分享示例警报文件。提前致谢
I have added instance='ip'
to differentiate ie expr: engine_daemon_container_states_containers{instance="serverA",state="running"} < 10
我添加了
instance='ip'
来区分 ie expr: engine_daemon_container_states_containers{instance="serverA",state="running"} < 10
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.