Alertmanager to ntfy-sh webhook container for Kubernetes deployments
This repository has been archived on 2025-04-05. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
Tommy Skaug 3ba6be2d4e
All checks were successful
Update Helm Chart / Lint (push) Successful in 3s
Update Helm Chart / Audit (push) Successful in 4s
Update Helm Chart / Outdated APIs (push) Successful in 3s
Update Helm Chart / Publish Helm Chart (push) Successful in 4s
chore: bump version to 1.5.3 and remove topology spread constraints
2025-03-28 20:24:11 +01:00
.forgejo chore: set actions to local repo 2025-03-03 06:21:38 +01:00
chart chore: bump version to 1.5.3 and remove topology spread constraints 2025-03-28 20:24:11 +01:00
grafana chore: misc updates and refactor for alert aggregation 2024-12-21 13:12:56 +01:00
sample-data chore: misc updates and refactor for alert aggregation 2024-12-21 13:12:56 +01:00
src feat: add /health endpoint 2025-01-23 08:03:44 +01:00
.gitignore initial commit 2022-11-02 14:46:55 +01:00
Dockerfile chore: build with go, not make 2025-01-23 07:50:38 +01:00
LICENSE chore: add latest changes and a build 2024-08-11 21:02:39 +02:00
README.md chore: experimental update 2025-01-21 23:05:12 +01:00
renovate.json Add renovate.json 2024-08-08 01:00:55 +00:00
Taskfile.yaml chore: add more building tools and scripts 2024-09-09 21:27:32 +02:00

🚨 alertmanager-ntfy 🚨

This project is a lightweight bridge between Prometheus Alertmanager and ntfy. It sends push notifications to your devices.

📦 Features

  • Configure via environment variables.
  • Exports Prometheus metrics to monitor webhook activity.
  • Built for Kubernetes, but works anywhere
  • Has a flake.nix

🚀 Getting Started

To send your Alertmanager alerts to ntfy, configure the following environment variables:

Variable Description Example
HTTP_ADDRESS Address to listen on localhost
HTTP_PORT Port to listen on 8080
NTFY_SERVER_URL ntfy server to send alerts to https://ntfy.sh
NTFY_USER Username for basic auth (optional) myuser
NTFY_PASS Password for basic auth (optional) supersecret
LOG_LEVEL Log level (debug, info, warn, error) info

Example

To expose the service on localhost:8080 and send alerts to an ntfy topic https://ntfy.sh/mytopic:

export HTTP_ADDRESS="localhost"
export HTTP_PORT="8080"
export NTFY_SERVER_URL="https://ntfy.sh/mytopic"
export NTFY_USER="myuser"
export NTFY_PASS="supersecret"
export LOG_LEVEL="info"

🛠️ Nix Support

For Nix/NixOS users, a flake.nix is provided for build, run and test.

Building with Nix

To build the container image: nix build .#container

If you are not on amd64 use nix build .#packages.aarch64-darwin.x86_64-linux.container.

Push the built container to your preferred registry: nix run .#push-container

You can run the application directly from Nix with: nix run

To simulate alerts with test data: nix run '.#mock-hook'

🖥️ Nix Module

A Nix module is provided for easy setup and integration. A minimal configuration would look like this:

# Add to flake inputs
inputs.alertmanager-ntfy.url = "git+https://code.252.no/tommy/alertmanager-ntfy";

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

# Enable the service and configure options
services.alertmanager-ntfy = {
  enable = true;
  httpAddress = "localhost";
  httpPort = "9999";
  ntfyTopic = "https://ntfy.sh/test";
  ntfyPriority = "high";
  envFile = "/var/src/secrets/alertmanager-ntfy/envfile";
};

🔍 Prometheus Metrics

The service exports Prometheus metrics for tracking webhook requests and errors. By default, these metrics are exposed at /metrics:

  • http_requests_total: Total number of HTTP requests received.
  • http_request_errors_total: Total number of errors encountered during request processing.

🤩 Gratitude

This project is based on the fantastic work by pinpox/alertmanager-ntfy, with adaptations for Kubernetes deployments and enhanced logging/metrics support.