benjojo / alertmanager-discord

Take your alertmanager alerts, into discord

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change ListenAddress

Xtreme89 opened this issue · comments

Hi,

i want to change the ListenAddress but seems that it doesn't work. Discord Notification is working but not changing the ListenAddress.

Here is my compose file

alertmanager_discord:
image: benjojo/alertmanager-discord
container_name: alertmanager_discord
restart: always
networks:
- monitoring
env_file:
- 'env.discord'
labels:
org.label-schmea.group: "monitoring"

Enviroment File:

LISTEN_ADDRESS=0.0.0.0:9099
DISCORD_WEBHOOK=myurl

Logs

Attaching to alertmanager_discord
alertmanager_discord | 2020-11-30T18:30:47.178861110Z 2020/11/30 18:30:47 Listening on: 0.0.0.0:9094

Was it working before? aka before #9 was merged?

I'm unable to reproduce in a non docker environment:

[19:10:29] ben@metropolis:/tmp/alertmanager-discord$ DISCORD_WEBHOOK=https://discordapp.com/api/webhooks/000000000000000000/aaaa ./alertmanager-discord 
2020/11/30 19:10:53 Listening on: 127.0.0.1:9094
^C
[19:10:54] ben@metropolis:/tmp/alertmanager-discord$ LISTEN_ADDRESS=0.0.0.0:6666 DISCORD_WEBHOOK=https://discordapp.com/api/webhooks/000000000000000000/aaaa ./alertmanager-discord 
2020/11/30 19:11:06 Listening on: 0.0.0.0:6666
^C

Giving the default is 127.0.0.1:9094 and you are binding on 0.0.0.0:9094. Are you sure you are not passing 0.0.0.0:9094 in from the command line? thus overriding your env var?

Was it working before? aka before #9 was merged?

I dont know, tested today evening for the first time.

Strange that it is working on your testlab with setting up the Listen Adress, on me it is not working with env but webhook url with env is working.

I will try to enter container and change listen address on the container then i will give you an update

I assumed you figured it out @Xtreme89

Hi,
sorry for my late answer so i tried something

when i run the following command then i can change the port but it is not possible over the env file

docker-compose exec alertmanager_discord /go/bin/alertmanager-discord LISTEN_ADDRESS=0.0.0.0:9099
2020/12/02 12:24:20 Listening on: 0.0.0.0:9099

I think this is more likely a docker / docker-compose issue than a alertmanager-discord one. I assume the envvar is either being tampered with or being removed by docker / docker-compose, or not set correctly.

I found out the reason it is default to 0.0.0.0.9094 is because of Dockerfile
ENTRYPOINT ["/go/bin/alertmanager-discord", "-listen.address", "0.0.0.0:9094"]

What @Xtreme89 did is override default Dockerfile ENTRYPOINT

The best way to fix this is to fix Dockerfile ENTRY POINT to following
ENTRYPOINT ["/go/bin/alertmanager-discord"]

And let application handle env