1
0
Fork 0
alertmanager-ntfy/README.md

68 lines
1.6 KiB
Markdown
Raw Normal View History

2022-11-02 13:16:19 +00:00
# alertmanager-ntfy
Listen for webhooks from
[Alertmanager](https://prometheus.io/docs/alerting/latest/alertmanager/) and
send them to [ntfy](https://ntfy.sh/) push notifications
Configuration is done with environment variables.
2022-11-03 10:14:36 +00:00
| Variable | Description | Example |
|---------------|------------------------------|------------------------|
| HTTP_ADDRESS | Adress to listen on | `localhost` |
| HTTP_PORT | Port to listen on | `8080` |
| NTFY_TOPIC | ntfy topic to send to | `https://ntfy.sh/test` |
| NTFY_USER | ntfy user for basic auth | `myuser` |
| NTFY_PASS | ntfy password for basic auth | `supersecret` |
| NTFY_PRIORITY | Priority of ntfy messages | `high` |
2022-11-02 13:16:19 +00:00
# Nix
For Nix/Nixos users a `flake.nix` is provided to simplify the build. It also
privides app to test the hooks with mocked data from `mock.json`
### Build
```sh
nix build
```
### Run directly
```sh
nix run
```
### Test alerts
```sh
nix run '.#mock-hook'
```
### Module
The flake also includes a NixOS module for ease of use. A minimal configuration
will look like this:
```nix
# Add to flake inputs
inputs.alertmanager-ntfy.url = "github:pinpox/alertmanager-ntfy";
# Import the module in your configuration.nix
imports = [
2024-01-26 01:31:33 +00:00
self.inputs.alertmanager-ntfy.nixosModules.alertmanager-ntfy
2022-11-02 13:16:19 +00:00
];
# Enable and set options
services.alertmanager-ntfy = {
enable = true;
httpAddress = "localhost";
2022-11-02 13:48:45 +00:00
httpPort = "9999";
2022-11-02 13:16:19 +00:00
ntfyTopic = "https://ntfy.sh/test";
2022-11-03 10:14:36 +00:00
ntfyPriority = "high";
2022-11-02 13:16:19 +00:00
envFile = "/var/src/secrets/alertmanager-ntfy/envfile";
};
```