A Komodo Alerter endpoint that forwards alerts to ntfy.
137
A Komodo Alerter endpoint that forwards alerts to ntfy.
A Rust (axum) port of the Deno komodo-utilities ntfy notifier. It uses the same environment variables, so it works as a drop-in replacement.
Komodo POSTs each alert as JSON to http://<host>:7000/. The alert is turned into a notification and published to your ntfy topic:
| Komodo alert | ntfy notification |
|---|---|
level: WARNING, ServerCpu on srv at 91.6% | [WARNING] ServerCpu for srv: Hit 92% (priority 4) |
level: OK, resolved ServerMem | [OK] ServerMem for srv on host: ✅ Used 1,234.5/2,048GB (priority 3) |
The endpoint always replies 200. Push failures are logged with ntfy's response so they can be diagnosed (see Troubleshooting).
services:
komodo-ntfy:
image: pasinduakalpa/komodo-ntfy-rs:latest
restart: unless-stopped
env_file: .env
Copy .env.example to .env, then set at least NTFY_URL and NTFY_TOPIC.
Create an Alerter in Komodo:
Customhttp://komodo-ntfy:7000. Use the service name if it's on the same Docker network as Komodo Core; otherwise use the host and port.Press Test Alerter in Komodo. A [OK] Test for <alerter name> notification should arrive in ntfy.
All settings are environment variables. See .env.example for full descriptions.
| Variable | Default | Description |
|---|---|---|
NTFY_URL | required | ntfy server base URL |
NTFY_TOPIC | required | Topic to publish to |
NTFY_USER / NTFY_PASSWORD | – | Basic auth (wins over token) |
NTFY_TOKEN | – | Access token, sent as Bearer |
NTFY_OK_PRIORITY | 3 | ntfy priority for OK |
NTFY_WARNING_PRIORITY | 4 | ntfy priority for WARNING |
NTFY_CRITICAL_PRIORITY | 5 | ntfy priority for CRITICAL |
LEVEL_IN_TITLE | true | Prefix the title with [LEVEL] |
INDICATE_RESOLVED | true | Prefix resolved alerts with ✅ |
ALLOW_RESOLVED_TYPE | both | resolved, unresolved, or both |
UNRESOLVED_TIMEOUT | – | Hold unresolved alerts for N ms; skip both if resolved in time |
UNRESOLVED_TIMEOUT_TYPES | all | Alert types the timeout applies to |
PORT | 7000 | Listen port |
When a push fails, the log shows ntfy's HTTP status and response body:
| Log | Meaning |
|---|---|
HTTP 401 ... "code":40101 | Wrong username/password or token |
HTTP 403 ... "code":40301 | ntfy treated the request as anonymous or as a user without write access to the topic |
HTTP 403 cf-mitigated=challenge cf-ray=... | Cloudflare challenged the request (a server can't solve it). Look up the ray in Cloudflare Security → Events to see which rule fired, then skip it for the ntfy host, or point NTFY_URL at ntfy's internal address |
HTTP 403 with another HTML body | Some other proxy in front of ntfy blocked the request |
error sending request | ntfy is unreachable (DNS, network, TLS) |
To check from the Docker host:
curl -i -H "Authorization: Bearer $NTFY_TOKEN" -d test "$NTFY_URL/$NTFY_TOPIC"
Requires Rust 1.99 (pinned in mise.toml).
cargo test # unit + integration tests (uses a fake ntfy server)
cargo clippy --all-targets -- -D warnings
PORT=17000 NTFY_URL=http://localhost:8080 NTFY_TOPIC=test cargo run
Send a sample alert:
curl -XPOST localhost:17000 -H 'content-type: application/json' -d '{
"resolved": false, "level": "WARNING",
"target": {"type": "Server", "id": "s1"},
"data": {"type": "ServerCpu", "data": {"name": "srv", "percentage": 91.6}}
}'
Build the image locally:
docker build -t komodo-ntfy-rs .
Push a version tag:
git tag v1.2.3 && git push origin v1.2.3
release.yml runs the tests, builds linux/amd64 and linux/arm64 images on native runners, and pushes 1.2.3, 1.2 and latest to Docker Hub.
Required repository secrets: DOCKERHUB_USERNAME and DOCKERHUB_TOKEN (a Docker Hub access token with read/write scope).
Content type
Image
Digest
sha256:65d728cf7…
Size
6.5 MB
Last updated
8 days ago
docker pull pasinduakalpa/komodo-ntfy-rs