简体   繁体   English

无法在 Prometheus Alert Manager 中看到警报

[英]Unable to see Alerts in Prometheus Alert Manager

I have defined a basic "service_down" alert in Prometheus to capture the status of a system:我在 Prometheus 中定义了一个基本的“service_down”警报来捕获系统的状态: 在此处输入图片说明 Then, I'm trying to hook this alert from the Alert manager, using the following configuration:然后,我尝试使用以下配置从警报管理器中挂钩此警报:

global:
  resolve_timeout: 5m

route:
  group_by: ['service_down']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'web.hook'
receivers:
- name: 'web.hook'
  webhook_configs:
  - url: 'http://127.0.0.1:5001/'
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['service_down', 'dev', 'instance']

However I see no Alert displayed in the Alert Manager:但是我看不到警报管理器中显示的警报: 在此处输入图片说明 I'm pretty new to Prometheus yet not able to run this very basic example.我对 Prometheus 还很陌生,但无法运行这个非常基本的示例。 Any help?有什么帮助吗? Thanks谢谢

At first sight, your configuration for Alertmanager is not correct review your group_by (use label name instead of value) and inhibit_rules configs乍一看,您对 Alertmanager 的配置不正确 查看您的group_by (使用标签名称而不是值)和inhibit_rules配置

https://prometheus.io/docs/alerting/latest/configuration/ https://prometheus.io/docs/alerting/latest/configuration/

You should have some errors on the AM logs.您应该在 AM 日志上有一些错误。

In the case you can't still see the alerts on AM check Prometheus status, it contains a list of AM instances when using Service Discovery.如果您仍然看不到 AM 检查 Prometheus 状态的警报,它包含使用服务发现时的 AM 实例列表。

If you still have problems... I'd recommend to enable debug logs and check if Promethues is failing to send the POST request to AM or if it's AM processing it如果您仍然有问题......我建议启用调试日志并检查 Promethues 是否未能将 POST 请求发送到 AM 或者它是否正在处理它

in my case the problem was authentication.就我而言,问题是身份验证。 my alert manager server uses simple auth and you should add simple_auth config to your promethues.yml file in alerting section我的警报管理器服务器使用简单的身份验证,您应该将 simple_auth 配置添加到警报部分的 promethues.yml 文件中

...
alerting:
  alertmanagers:
    - scheme : "https"
    - api_version: "v1"
    - basic_auth:
        username: username
        password: "password"
    - static_configs:
        - targets:
            [
              "servicenameindocker:9093",
              "serveripaddr:9093",
              "serverlink:9093",
            ]
...

and about target part ' servicenameindocker:9093 ' is the docker service name in the case of using docker.关于目标部分' servicenameindocker:9093 '是使用docker的情况下的docker服务名称。

i hope it helps you.我希望它能帮助你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM