1
0
Fork 0
alertmanager-ntfy/README.md

76 lines
No EOL
1.8 KiB
Markdown

# 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.
| Variable | Description | Example |
|-----------------|------------------------------|-------------------|
| HTTP_ADDRESS | Adress to listen on | `localhost` |
| HTTP_PORT | Port to listen on | `8080` |
| NTFY_SERVER_URL | ntfy server to send to | `https://ntfy.sh` |
| NTFY_USER | ntfy user for basic auth | `myuser` |
| NTFY_PASS | ntfy password for basic auth | `supersecret` |
# 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 .#container
```
### Push to registry
```sh
nix run .#push-container
```
### 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 = [
self.inputs.alertmanager-ntfy.nixosModules.default
];
# Enable and set options
services.alertmanager-ntfy = {
enable = true;
httpAddress = "localhost";
httpPort = "9999";
ntfyTopic = "https://ntfy.sh/test";
ntfyPriority = "high";
envFile = "/var/src/secrets/alertmanager-ntfy/envfile";
};
```
## 🤩 Gratitude
This repo is based on the work by [pinpox/alertmanager-ntfy](https://github.com/pinpox/alertmanager-ntfy). Adaptions has been made for Kubernetes deployment.