docker-autoheal icon indicating copy to clipboard operation
docker-autoheal copied to clipboard

Is there a way to test notifications?

Open edrock200 opened this issue 2 years ago • 8 comments

I have the notification webhook doing to a discord webhook, but it doesn't seem to be working. Is there. Way to test webhook notifications on demand? Thanks in advance.

edrock200 avatar Jun 20 '22 15:06 edrock200

Same here, using a discord webhook, nothing showing up in discord. Discord is working with other webhooks. Looking for a way to troubleshoot. thanks.

PriamX avatar Sep 19 '22 19:09 PriamX

It doesnt work with discord as its written for slack and they are slightly different.. See the PRs for ones that do. I use the Apprise one to send to discord, email, etc.

Wave-Ninja avatar Sep 19 '22 22:09 Wave-Ninja

I've tried this three different ways with no luck. I'm deploying using docker compose, for the WEBHOOK_URL I've tried it three different ways of using quotes:

    environment:
      - "AUTOHEAL_CONTAINER_LABEL=all" # monitor all containers w/a healthcheck
      - "AUTOHEAL_INTERVAL=30"         # check every 30 seconds
      - "AUTOHEAL_START_PERIOD=180"    # wait 3 mins before first healthcheck
      - WEBHOOK_URL="https://discord.com/api/webhooks/XXXXXXXXXXX/XXXXXXXXXX"

And....

- "WEBHOOK_URL=https://discord.com/api/webhooks/XXXXXXXXXXX/XXXXXXXXXX"

Lastly (no quotes):

- WEBHOOK_URL=https://discord.com/api/webhooks/XXXXXXXXXXX/XXXXXXXXXX

PriamX avatar Sep 19 '22 22:09 PriamX

It doesnt work with discord as its written for slack and they are slightly different.. See the PRs for ones that do. I use the Apprise one to send to discord, email, etc.

PRs? Where can I find those? I must have missed seeing some documentation. thanks.

PriamX avatar Sep 19 '22 22:09 PriamX

https://github.com/willfarrell/docker-autoheal/pull/74 - Apprise notifications https://github.com/willfarrell/docker-autoheal/pull/79 - Make the webhook universal to allow it to work with discord.

You need to fork the repo, merge the PR (pull request), build the resulting docker image and optionally push it to dockerhub or somewhere. If you arent familiar with this then you'll need to wait.

Wave-Ninja avatar Sep 19 '22 22:09 Wave-Ninja

#74 - Apprise notifications #79 - Make the webhook universal to allow it to work with discord.

You need to fork the repo, merge the PR (pull request), build the resulting docker image and push it to dockerhub or somewhere. If you arent familiar with this then you'll need to wait.

Thanks, I'm familiar, but not sure if it's worth it. For now I may just use docker logs autoheal periodically to grab any "restarting" entries and eamil or IM them to me.

Thank you for your help and the information.

PriamX avatar Sep 19 '22 22:09 PriamX

https://hub.docker.com/r/rxwatcher/autoheal is one with the Apprise notifications in it. You add an additional environment variable: APPRISE_URL: https://apprise.domain.com/notify/apprise?tag=my_tag

Wave-Ninja avatar Sep 19 '22 22:09 Wave-Ninja

https://hub.docker.com/r/rxwatcher/autoheal is one with the Apprise notifications in it. You add an additional environment variable: APPRISE_URL: https://apprise.domain.com/notify/apprise?tag=my_tag

Ah, thank you, I'll give that a try.

PriamX avatar Sep 19 '22 22:09 PriamX

I run a apprise api server with a common config that is loaded with all of my possible communications needs. In it are several discord webhooks that are tagged.

My servers are red, blue, green, etc so I have different tags in the apprise config for red, blue, green, etc.

I then use that docker image with various tags so I have a tag with blue which will only send container restart notifications on the blue server to the blue discord channel, red to only the red discord channel, etc.

Apprise is infinitely customizable.

Wave-Ninja avatar Sep 19 '22 22:09 Wave-Ninja

That's nice, I'll check out Apprise. I have some legacy system that could benefit with a migration to something like that. Really appreciate you pointing me that way.

PriamX avatar Sep 19 '22 23:09 PriamX

BTW, I don't know if it's worth mentioning, but a change on line 75 of docker-entrypoint from:

"text":"$text"

to:

"username":"autoheal","content":"$text"

Allows it to work with Discord, in a very basic way.

PriamX avatar Sep 19 '22 23:09 PriamX

Hello I think apprise is well configured. Is there a way to test autoheal notification ? Thanks

stanthewizzard avatar Apr 13 '24 08:04 stanthewizzard