prometheus / alertmanager

Prometheus Alertmanager
https://prometheus.io
Apache License 2.0
6.66k stars 2.16k forks source link

Feature suggestion: Add Gotify as receiver #2120

Open etho201 opened 4 years ago

etho201 commented 4 years ago

Gotify is a self-hosted server application that supports sending messages via a REST-API. Is there any way to add Gotify as a receiver within Alertmanager?

roidelapluie commented 4 years ago

Thanks for suggesting this change. Unfortunately, we are currently not accepting new integrations.

We can only provide the stability and performance we want to provide if we can test integrations in an automated and scalable fashion. For this reason, we are suggesting people integrate with the help of our generic interfaces by either integrating natively or putting a rewriting proxy in the middle. We would be more than happy to list this on our integrations page.

Even if existing integrations can not be tested in an automated fashion, we will not remove them for reasons of compatibility. This also means that any additions we take on, or any changes to existing integrations we make or accept, will mean maintaining and testing these until at least the next major version, realistically even beyond that.

Feel free to question this answer on our developer mailing list, but be aware it's unlikely that you will get a different answer.

That said, it looks like Gotify supports plugins (https://gotify.net/docs/plugin) and could therefore support out of the box alertmanager wehbooks

A1kmm commented 4 years ago

I made a really simple app, available at https://gitlab.com/A1kmm/alertmanager-to-gotify, to send a notification to Gotify for each alert, with the details of the notification controlled by annotations.

simonpasquier commented 4 years ago

@A1kmm you can add your project here: https://prometheus.io/docs/operating/integrations/#alertmanager-webhook-receiver

DRuggeri commented 4 years ago

I took the same route as @A1kmm, but used go since I'd prefer to avoid docker for my use case: https://github.com/DRuggeri/alertmanager_gotify_bridge

It works pretty well though isn't completely finished.

I've opened a PR as suggested by @simonpasquier to add it to the docs.

scottwallacesh commented 4 years ago

I've written my own solution as the others didn't quite fit my needs: https://github.com/scottwallacesh/alertify

It's simple enough but the main "feature" is that it sends through the resolved alerts and can even remove the original alert from Gotify, if enabled. It's written with Docker in mind but can run independently if needed.

LukasKnuth commented 3 months ago

This issue has been open for years now. Are you accepting new integrations again?

Would you accept a PR if I implemented it directly in alert-manager? Less complexity seems better to me.

Tuxdude commented 2 months ago

I build and run my own alertmanager docker images. As part of that, I decided to take the route of building a native integration in alertmanager to gotify rather than running one more service to act as a bridge.

If anyone is interested, you can take a look at this patch - https://github.com/TuxdudeHomeLab/docker-image-alertmanager/blob/master/patches/01-gotify.diff , The patch builds successfully against the latest version of alertmanager, but I didn't get to write any tests. Also, I plan to maintain this patch only as part of my alertmanager docker image. Anyone is welcome to use or reuse it any form that works for them.

If there is interest from the alertmanager team to integrate this, I am happy to put in the effort to upstream it as a proper PR. But I would like to hear the stance first before I put in the extra effort, given the past discussions didn't seem as promising.

LukasKnuth commented 2 months ago

I have also built something to get this working: https://github.com/LukasKnuth/gotify-slack-webhook/

It's a plugin for Gotify which will accept Slack Incoming Webhooks (as already supported by AlertManager). It's good enough for my current use-case, have a look if you're interested.

najtin commented 1 month ago

I wrote a gotify plugin to directly receive and process webhooks. https://codeberg.org/ocimea/gotify-alertmanager-plugin It aims to keep the code base relatively small. You are welcome to share your thoughts.