DRuggeri / alertmanager_gotify_bridge

A bridge between Prometheus AlertManager and a Gotify server
Apache License 2.0
65 stars 9 forks source link

Connection refused #35

Closed yanne057 closed 1 month ago

yanne057 commented 2 months ago

I have Prometheus, Alertmanager and Gotify setup in Docker. But when a alert should be sent out to gotify i dont get a message. Has someone got an idea what i'm doing wrong?

When i look at the logs of Alertmanager i get the following error:

ts=2024-09-09T11:26:58.533Z caller=notify.go:848 level=warn component=dispatcher receiver=gotify integration=webhook[0] aggrGroup="{}:{alertname=\"MonitorDown\", severity=\"warning\"}" msg="Notify attempt failed, will retry later" attempts=1 err="Post \"<redacted>\": dial tcp 127.0.0.1:9080: connect: connection refused"

This is my docker-compose.yml:

  alertmanager_gotify_bridge:
    image: druggeri/alertmanager_gotify_bridge:2.3.1
    container_name: alertmanager_gotify_bridge
    networks:
      - traefik
    environment:
      - GOTIFY_TOKEN=TOKEN
      - GOTIFY_ENDPOINT=https://gotify.domain/message
    volumes:
      - ./bridge_alertmanager_gotify_templates:/./templates
    ports:
      - 9080:9080
    restart: unless-stopped
    command:
      - '--port=9080'

And i have configured the following in the alertmanager.yml

receivers:
  - name: 'gotify'
    webhook_configs:
      - url: http://127.0.0.1:9080/gotify_webhook?token=TOKEN
        send_resolved: true
DRuggeri commented 1 month ago

Hi there, @yanne057. My guess is that when alertmanager is reaching out, there is no network path to the container in which the bridge is running and it is instead trying to use localhost within the alertmanager container. I think you would want to create docker links or a shared network for all of the containers to use - or, alternatively, switch to using host networking.

yanne057 commented 1 month ago

Thanks, somehow got it working, the contaienrs are in the same network I just changed "127.0.0.1" to the docker container name