Notifications¶
Wanepia's alert system is built around three primitives: policies, channels, and logs.
How alerting works¶
StateChangeEvent (NATS)
│
▼
notify service
│
├─ load policy for the check
│ silenced? → skip
│ recovery? + notify_on_recovery=false → skip
│ cooldown active? → skip
│
└─ for each active channel:
send with retry (up to 3 attempts, exponential backoff)
log result (pending → sent / failed)
if down and repeat_interval > 0 → re-send periodically
Notification policy¶
One policy per check (created automatically when you add a channel via CLI).
| Field | Default | Description |
|---|---|---|
cooldown_seconds |
300 |
Minimum gap between alerts for the same check |
notify_on_recovery |
true |
Also alert when entity recovers to up |
silenced |
false |
Pause all alerts (useful during maintenance) |
repeat_interval_seconds |
0 |
Re-alert every N seconds while entity stays down; 0 = no repeat |
Managing policies¶
Silencing during maintenance¶
wnp notify set-policy <check-id> --silence true
# ... do your maintenance ...
wnp notify set-policy <check-id> --silence false
Notification channels¶
Channels specify where to send alerts. Multiple channels can be attached to the same policy.
| Channel type | Use case |
|---|---|
slack |
Post to a Slack channel via incoming webhook |
discord |
Post to a Discord channel via webhook |
webhook |
HTTP POST JSON payload to any endpoint |
nats |
Publish raw JSON to a NATS subject |
ntfy |
Push notification via ntfy.sh (phone/desktop) |
Adding a channel¶
Listing and removing channels¶
# List all channels across all checks
wnp notify channels
# Remove a channel
wnp notify rm-channel <check-id> <channel-id>
Delivery logs¶
Every send attempt is logged:
CHANNEL STATUS ATTEMPTS SENT AT ERROR
a1b2c3d4 sent 1 2024-01-20 03:18
e5f6g7h8 failed 3 — connection refused
Statuses: pending → retrying → sent | failed.
Failed attempts retry up to 3 times with exponential backoff (1 s, 2 s, 4 s).
Channel-specific configuration¶
| Channel | Config keys |
|---|---|
| Slack | url — incoming webhook URL |
| Discord | url — Discord webhook URL |
| Webhook | url — endpoint URL; secret — HMAC signing secret (optional) |
| NATS | subject — NATS subject to publish to |
| ntfy | url — full topic URL (e.g. https://ntfy.sh/my-alerts); token — Bearer token for protected topics (optional) |
See the dedicated pages under Notifications in the sidebar for per-channel details and payload formats.