1
0
Fork 0
Alertmanager to ntfy-sh webhook container for Kubernetes deployments
Find a file
Pablo Ovelleiro Corral 48cf817171
Merge pull request #3 from pinpox/add-license-1
Create LICENCE
2023-03-01 22:14:35 +01:00
.gitignore initial commit 2022-11-02 14:46:55 +01:00
default.nix initial commit 2022-11-02 14:46:55 +01:00
flake.lock initial commit 2022-11-02 14:46:55 +01:00
flake.nix Update flake 2022-11-02 16:50:31 +01:00
go.mod initial commit 2022-11-02 14:46:55 +01:00
go.sum initial commit 2022-11-02 14:46:55 +01:00
LICENCE Create LICENCE 2023-03-01 22:14:21 +01:00
main.go Enable basic auth only if username/password is set 2023-02-10 19:35:21 +00:00
mock.json initial commit 2022-11-02 14:46:55 +01:00
module.nix Add priority 2022-11-03 11:14:36 +01:00
README.md Add priority 2022-11-03 11:14:36 +01:00

alertmanager-ntfy

Listen for webhooks from Alertmanager and send them to ntfy 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_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

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

nix build

Run directly

nix run

Test alerts

nix run '.#mock-hook'

Module

The flake also includes a NixOS module for ease of use. A minimal configuration will look like this:


# Add to flake inputs
inputs.alertmanager-ntfy.url = "github:pinpox/alertmanager-ntfy";

# Import the module in your configuration.nix
imports = [
	self.inputs.alertmanager-nfty.nixosModules.alertmanager-ntfy
];

# 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";
};