benjojo / alertmanager-discord

Take your alertmanager alerts, into discord
Apache License 2.0
177 stars 78 forks source link

Change ListenAddress #11

Closed Xtreme89 closed 3 years ago

Xtreme89 commented 3 years ago

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:

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

benjojo commented 3 years ago

Was it working before? aka before https://github.com/benjojo/alertmanager-discord/pull/9 was merged?

benjojo commented 3 years ago

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?

Xtreme89 commented 3 years ago

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

benjojo commented 3 years ago

I assumed you figured it out @Xtreme89

Xtreme89 commented 3 years ago

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
benjojo commented 3 years ago

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.

thanatchakromsang commented 3 years ago

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

benjojo commented 3 years ago

Aha! I can fix this! I'll add it to the to-do today.

On Mon, 18 Jan 2021, 09:10 pipe, notifications@github.com wrote:

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 https://github.com/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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/benjojo/alertmanager-discord/issues/11#issuecomment-762103331, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPK4W4I6FSSYAYT6B3LCDS2P3JHANCNFSM4UH6KX3A .

thanatchakromsang commented 3 years ago

Thank you @benjojo