feat(alerting): Add overrides for Ntfy provider (#918)

* Add overrides to Ntfy alert provider

* Update alerting/provider/ntfy/ntfy.go

---------

Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
Stephen
2024-11-30 19:09:20 -08:00
committed by GitHub
parent 29cbff6774
commit 778019590d
3 changed files with 206 additions and 24 deletions

View File

@ -240,7 +240,7 @@ If you want to test it locally, see [Docker](#docker).
| `ui.buttons[].link` | Link to open when the button is clicked. | Required `""` |
| `maintenance` | [Maintenance configuration](#maintenance). | `{}` |
If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
If you want more verbose logging, you may set the `GATUS_LOG_LEVEL` environment variable to `DEBUG`.
Conversely, if you want less verbose logging, you can set the aforementioned environment variable to `WARN`, `ERROR` or `FATAL`.
The default value for `GATUS_LOG_LEVEL` is `INFO`.
@ -987,18 +987,26 @@ endpoints:
#### Configuring Ntfy alerts
| Parameter | Description | Default |
|:---------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------|:------------------|
| `alerting.ntfy` | Configuration for alerts of type `ntfy` | `{}` |
| `alerting.ntfy.topic` | Topic at which the alert will be sent | Required `""` |
| `alerting.ntfy.url` | The URL of the target server | `https://ntfy.sh` |
| `alerting.ntfy.token` | [Access token](https://docs.ntfy.sh/publish/#access-tokens) for restricted topics | `""` |
| `alerting.ntfy.email` | E-mail address for additional e-mail notifications | `""` |
| `alerting.ntfy.click` | Website opened when notification is clicked | `""` |
| `alerting.ntfy.priority` | The priority of the alert | `3` |
| `alerting.ntfy.disable-firebase` | Whether message push delivery via firebase should be disabled. [ntfy.sh defaults to enabled](https://docs.ntfy.sh/publish/#disable-firebase) | `false` |
| `alerting.ntfy.disable-cache` | Whether server side message caching should be disabled. [ntfy.sh defaults to enabled](https://docs.ntfy.sh/publish/#message-caching) | `false` |
| `alerting.ntfy.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
| Parameter | Description | Default |
|:-------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------|:------------------|
| `alerting.ntfy` | Configuration for alerts of type `ntfy` | `{}` |
| `alerting.ntfy.topic` | Topic at which the alert will be sent | Required `""` |
| `alerting.ntfy.url` | The URL of the target server | `https://ntfy.sh` |
| `alerting.ntfy.token` | [Access token](https://docs.ntfy.sh/publish/#access-tokens) for restricted topics | `""` |
| `alerting.ntfy.email` | E-mail address for additional e-mail notifications | `""` |
| `alerting.ntfy.click` | Website opened when notification is clicked | `""` |
| `alerting.ntfy.priority` | The priority of the alert | `3` |
| `alerting.ntfy.disable-firebase` | Whether message push delivery via firebase should be disabled. [ntfy.sh defaults to enabled](https://docs.ntfy.sh/publish/#disable-firebase) | `false` |
| `alerting.ntfy.disable-cache` | Whether server side message caching should be disabled. [ntfy.sh defaults to enabled](https://docs.ntfy.sh/publish/#message-caching) | `false` |
| `alerting.ntfy.default-alert` | Default alert configuration. <br />See [Setting a default alert](#setting-a-default-alert) | N/A |
| `alerting.ntfy.overrides` | List of overrides that may be prioritized over the default configuration | `[]` |
| `alerting.ntfy.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` |
| `alerting.ntfy.overrides[].topic` | Topic at which the alert will be sent | `""` |
| `alerting.ntfy.overrides[].url` | The URL of the target server | `""` |
| `alerting.ntfy.overrides[].priority` | The priority of the alert | `0` |
| `alerting.ntfy.overrides[].token` | Access token for restricted topics | `""` |
| `alerting.ntfy.overrides[].email` | E-mail address for additional e-mail notifications | `""` |
| `alerting.ntfy.overrides[].click` | Website opened when notification is clicked | `""` |
[ntfy](https://github.com/binwiederhier/ntfy) is an amazing project that allows you to subscribe to desktop
and mobile notifications, making it an awesome addition to Gatus.
@ -1013,6 +1021,13 @@ alerting:
default-alert:
failure-threshold: 3
send-on-resolved: true
# You can also add group-specific to keys, which will
# override the to key above for the specified groups
overrides:
- group: "other"
topic: "gatus-other-test-topic"
priority: 4
click: "https://example.com"
endpoints:
- name: website
@ -1024,6 +1039,16 @@ endpoints:
- "[RESPONSE_TIME] < 300"
alerts:
- type: ntfy
- name: other example
group: other
interval: 30m
url: "https://example.com"
conditions:
- "[STATUS] == 200"
- "[BODY].status == UP"
alerts:
- type: ntfy
description: example
```