alerta / prometheus-config

Prometheus config for Alerta
MIT License
255 stars 102 forks source link

Getting - {"code":400,"errors":null,"message":"no alerts in Prometheus notification payload","status":"error"} #20

Closed vermasuraj10678 closed 5 years ago

vermasuraj10678 commented 5 years ago

Hi,

I am also getting this error. I have gone through many of the articles available on google and nothing helped. Can you please advise if i am doing anything wrong. All these three components i have configured using docker containers

I have integrated prometheus, alertmanager with alerta. Below is my prometheus.yml file

my global config

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      - ip:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
    - alert.rules.yml
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ['ip:9090']
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['ip:9100']
  - job_name: 'nginx_exporter'
    static_configs:
      - targets: ['ip:9113']
  - job_name: 'alert_manager'
    static_configs:
      - targets: ['ip:9093']
  - job_name: 's3-exporter'
    static_configs:
      - targets: ['ip:9340']
  - job_name: 'grafana'
    static_configs:
- targets: ['ip:3000']
  - job_name: 'container_exporter'
    static_configs:
      - targets: ['ip:9104']
  - job_name: 'alerta'
    metrics_path: /api/management/metrics
    static_configs:
    - targets: ['ip:80']
    basic_auth:
      username: xyz
      password: xyz

And also find below alertmanager.yml file

global:
  resolve_timeout: 5m
  smtp_smarthost: 'smtp.gmail.com:587'
  smtp_from: 'xyz'
  smtp_auth_username: 'xyz@gmail.com'
  smtp_auth_password: 'xyz'
route:
        group_by: ['alertname']
        group_wait: 10s
        group_interval: 10s
        repeat_interval: 1h
        receiver: 'suraj'
        routes:
        - match_re:
            env: 'production'
          receiver: 'alerta'
receivers:
- name: 'suraj'
  email_configs:
  - to: 'email id'
    #inhibit_rules:
    #- source_match:
    # severity: 'critical'
    #target_match:
    #  severity: 'warning'
    #equal: ['alertname', 'dev', 'instance']
- name: 'alerta'
  webhook_configs:
  - url: 'http://ip/api/webhooks/prometheus'
    send_resolved: true
    http_config:
      basic_auth:
        username: xyz
        password: xyz

My alertmanager is showing me alerts on the console. Same prometheus console showing alerts, but alerta console is not showing them. Below is the error i am getting while accessing http://IP:80/api/webhooks/prometheus

{"code":400,"errors":null,"message":"no alerts in Prometheus notification payload","status":"error"}
satterly commented 5 years ago

You need to include the alertmanager log files otherwise I can't' help you.

satterly commented 5 years ago

This issue is blocked waiting on more information. The description or subsequent comments do not provide enough information to triage, investigate or resolve the issue. Please review the description against the issue template and ensure all relevant information is included. If you do not know what is expected you can ask on Gitter chat.

satterly commented 5 years ago

Closing due to inactivity. If you believe this issue has been closed prematurely please provide more information to help progress the issue. If you do not know what is expected you can ask on Gitter chat.

Wythetells commented 5 years ago

I I have the same problem,after adding "startsAt": "2019-10-20T13:50:21+08:00"

gaddamidianil commented 5 years ago

@satterly alerta webhook is not working in alertmanager, its not posting the alerts to alerta tool. I'm trying to send a test notification but its fails with 400 error. curl -XPOST https://alerta.example.org/api/webhooks/prometheus?api-key=lafdlsdjfiADFsdjadfds3343lajfdakk { "code": 400, "errors": null, "message": "no alerts in Prometheus notification payload", "status": "error" }