webdevops / alertmanager2es

Collects alertmanager alerts and pushes them to ElasticSearch (fork from cloudflare)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: do not understand webhook version \"1\", only version \"4\" is supported

Dhyanesh97 opened this issue · comments

Webhook is working but receiving below error.
Used prom/alertmanager:v0.23.0 Image to run alertmanager as container.

{"file":"main.go:36","func":"main","level":"info","msg":"init exporter"}
{"file":"main.go:52","func":"main","level":"info","msg":"starting http server on 0.0.0.0:9097"}
{"file":"alertmanager2es.go:147","func":"HttpHandler","level":"error","msg":"unexpected end of JSON input"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}
{"file":"alertmanager2es.go:155","func":"HttpHandler","level":"error","msg":"do not understand webhook version \"1\", only version \"4\" is supported"}

alertmanager .yml

route:
  receiver: 'alertmanager2es'
  repeat_interval: 2h
  group_wait: 10s
  group_interval: 10s
  group_by: [ alertname ]
  routes:
  - receiver: 'mail'


receivers:
  - name: 'mail'
    email_configs:
    - to: 'mailAddr'
      send_resolved: true
  - name: 'alertmanager2es'
    webhook_configs:
    - url: 'http://IP:9097/webhook'

Docker

alertmanager:
    image: prom/alertmanager:v0.23.0
    container_name: prom_alert_manager
    restart: always
    networks:
      - analytics
    ports:
      - "9093:9093"
    volumes:
      - "./alertmanager:/config"
      - alertmanager-data:/data
    command: --config.file=/config/alertmanager.yml --log.level=debug

The webhook should be version 4 as alertmanager onlys sends the value "4": https://github.com/prometheus/alertmanager/blob/main/notify/webhook/webhook.go#L92

Not sure why you send out content as version 1 🤔

I was sending alerts through grafana alertmanager so the version was 1.
From prom alertmanager version seems to correct 4.