Alerting: Option for Discord notifier to use webhook name (#40463)

* Added an option to discord notifier to use discord's webhook name (useful for customizing notifications).

* Support ngalert system with discord username toggle

* Added ngalert discord test

* Apply suggestions from code review

Co-authored-by: gotjosh <josue.abreu@gmail.com>

* Docs updated with discord username setting

* Fix api integration test

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: gotjosh <josue.abreu@gmail.com>
This commit is contained in:
Skye
2021-10-26 11:55:10 -07:00
committed by GitHub
parent dfbb3c4e23
commit bce1011361
7 changed files with 103 additions and 32 deletions

View File

@@ -446,11 +446,12 @@ The following sections detail the supported settings and secure settings for eac
#### Alert notification `discord`
| Name | Secure setting |
| ---------- | -------------- |
| url | yes |
| avatar_url | |
| content | |
| Name | Secure setting |
| -------------------- | -------------- |
| url | yes |
| avatar_url | |
| content | |
| use_discord_username | |
#### Alert notification `slack`

View File

@@ -227,11 +227,12 @@ In DingTalk PC Client:
To set up Discord, you must create a Discord channel webhook. For instructions on how to create the channel, refer to
[Intro to Webhooks](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
| Setting | Description |
| --------------- | --------------------------------------------------------------------------------- |
| Webhook URL | Discord webhook URL. |
| Message Content | Mention a group using @ or a user using <@ID> when notifying in a channel. |
| Avatar URL | Optionally, provide a URL to an image to use as the avatar for the bot's message. |
| Setting | Description |
| ------------------------------ | ----------------------------------------------------------------------------------------------------- |
| Webhook URL | Discord webhook URL. |
| Message Content | Mention a group using @ or a user using <@ID> when notifying in a channel. |
| Avatar URL | Optionally, provide a URL to an image to use as the avatar for the bot's message. |
| Use Discord's Webhook Username | Use the username configured in Discord's webhook settings. Otherwise, the username will be 'Grafana.' |
Alternately, use the [Slack](#slack) notifier by appending `/slack` to a Discord webhook URL.