简体   繁体   English

如果有多个导出器,如何区分 Prometheus 中的警报规则

[英]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.

相关问题 普罗米修斯警报.rules; 如何按多个职位筛选? - Prometheus Alert.rules; How to filter by multiple jobs? 如何在警报规则中显示指标值 - How to display values of metrics in alert rules prometheus 如何在使用 prometheus、blackbox exporter 和 alertmanager 时在 slack alert 中显示 http 响应代码 - How to show http response code in slack alert while using prometheus, blackbox exporter and alertmanager 如何使警报规则在 Prometheus 用户界面上可见? - How to make alert rules visible on Prometheus User Interface? 如何为mesos和HAProxy进程编写prometheus警报规则。 - How to write prometheus alert rules for mesos and HAProxy process down.? 如何使用普罗米修斯规则提醒 Pod 重新启动 - How can I alert for pod restarted with prometheus rules 多个部署的 Prometheus 警报 - Prometheus Alert for Multiple Deployments 如何在Prometheus导出器(golang)中更新指标值 - How to update metric values in prometheus exporter (golang) 如何在 Kubernetes 中安装用于 Prometheus 监控的 MongoDb 导出器 - How to Install MongoDb Exporter for Prometheus Monitoring in Kubernetes 如何将进程导出器配置为 prometheus 配置文件? - How to configure process exporter to prometheus config file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM