alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

notify/discord: Create Discord integration

Open metalmatze opened this issue 2 years ago • 5 comments

For our https://demo.parca.dev instance we want to alert to be send to Discord. Therefore I've worked on integrating Discord directly into Alertmanager.

The integration doesn't need any external dependencies and uses JSON to send the payloads to Discord via webhooks to a specific channel.

This integration is already in use for our alerting for a week now and has been working great so far.

metalmatze avatar Jun 17 '22 10:06 metalmatze

This integration was heavily inspired by the work done in https://github.com/benjojo/alertmanager-discord Thanks for your hard work @benjojo.

metalmatze avatar Jun 17 '22 11:06 metalmatze

Ah ha! Sorry for not getting around to the original, but thanks for doing this anyway!

benjojo avatar Jun 17 '22 12:06 benjojo

Ah ha! Sorry for not getting around to the original, but thanks for doing this anyway!

No worries. This is how it works in open source, I guess. :relaxed:

metalmatze avatar Jun 17 '22 12:06 metalmatze

LGTM - I think the template can look better (e.g. better formatting when having multiple alerts and adding a link to the silences) but let's see what kind of feedback we get after people start using it.

Overall the messages in Discord could look way better indeed. However, most of the notifications use the same default template for messages. Hence, I opted to use the same one. It's always possible to write custom templates and use them with alertmanager.

metalmatze avatar Jul 04 '22 20:07 metalmatze

Are we waiting on something? Honestly don't remember.

metalmatze avatar Aug 18 '22 09:08 metalmatze

Does someone want to merge this? I can do that myself, but don't feel like that's a best practice. :)

metalmatze avatar Oct 12 '22 09:10 metalmatze

Hey! I'd like to hear from @gotjosh before merging. But since he's busy these days, I propose to merge it next week in case of no answer from him.

simonpasquier avatar Oct 14 '22 13:10 simonpasquier

Given it's been a lot more days, I'll go ahead and merge this. Let me know if there's something we should follow this up with!

metalmatze avatar Oct 25 '22 16:10 metalmatze

@metalmatze Hi, I just noticed that the docs for this are still missing at https://prometheus.io/docs/alerting/latest/configuration/ (source: https://github.com/prometheus/alertmanager/blob/main/docs/configuration.md). Could you add those as well?

juliusv avatar Dec 23 '22 11:12 juliusv

Hey, thanks for the ping. I bookmarked this issue in the hopes to remind myself in my free time to make the contribution.

metalmatze avatar Jan 04 '23 11:01 metalmatze

@metalmatze I can take a stab at it today if that's ok with you. If it remains undocumented, it's basically like the feature doesn't exist, so I think it's good to do it now :)

juliusv avatar Jan 04 '23 11:01 juliusv

PR out at https://github.com/prometheus/alertmanager/pull/3201

juliusv avatar Jan 04 '23 13:01 juliusv