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.
2024-09-09 19:25:18 +00:00
| 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` |
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
2024-08-11 19:02:39 +00:00
nix build .#container
2022-11-02 13:16:19 +00:00
```
2024-09-09 19:25:18 +00:00
### Push to registry
```sh
nix run .#push-container
```
2022-11-02 13:16:19 +00:00
### 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-02-04 23:00:03 +00:00
self.inputs.alertmanager-ntfy.nixosModules.default
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";
};
```
2024-08-11 19:02:39 +00:00
## 🤩 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.