List active Prometheus alert rules, silence noisy alerts during maintenance, and fire test notifications through your configured channels.
# See all firing and pending alerts
nself alerts list
# Silence an alert for 2 hours during a deploy
nself alerts silence HighDiskUsage --duration 2h
# Verify your Slack/PagerDuty/webhook channel is wired correctly
nself alerts test HighDiskUsagenself alerts <SUBCOMMAND> [FLAGS] [ARGS]nself alerts is a thin CLI over the Alertmanager and Prometheus APIs that nSelf bundles in the monitoring stack (Prometheus + Alertmanager + Grafana + Loki + 6 exporters). The monitoring stack is free and ships with every nSelf project — no license required.
Alert rules live in monitoring/alerts/ inside your project directory. They are loaded by Prometheus on nself start and watched for changes. You can edit rules manually or let nself doctor --deep auto-generate recommended rules for your enabled services.
Silences are stored in Alertmanager and survive restarts. The silence subcommand creates a new silence via the Alertmanager API; it does not modify alert rule files.
List all alert rules. By default shows only firing and pending alerts. Use --all to include inactive rules.
nself alerts list
# ALERT STATE SINCE LABELS
# HighDiskUsage firing 14m ago severity=warning, service=postgres
# HasuraDown pending 2m ago severity=critical
nself alerts list --all
nself alerts list --json| Flag | Type | Default | Description |
|---|---|---|---|
--all | bool | false | Include inactive (ok) alerts |
--json | bool | false | Output as JSON |
--severity | string | Filter by severity: critical, warning, info |
Create an Alertmanager silence for a named alert. The alert will not fire notifications for the silence duration but continues to appear in alerts list as silenced.
nself alerts silence HighDiskUsage
nself alerts silence HighDiskUsage --duration 4h --comment "Deploy in progress"
nself alerts silence HighDiskUsage --duration 30m --matcher 'service=postgres'| Flag | Type | Default | Description |
|---|---|---|---|
--duration | string | 2h | Silence duration (e.g. 30m, 4h, 24h) |
--comment | string | Reason for the silence (stored in Alertmanager) | |
--matcher | string | Additional label matcher (e.g. service=postgres) |
Fire a synthetic test notification for a named alert through all configured receivers (Slack, PagerDuty, email, webhook). Useful for verifying integrations without waiting for a real alert to fire.
nself alerts test HighDiskUsage
nself alerts test HasuraDown --receiver slack-ops| Flag | Type | Default | Description |
|---|---|---|---|
--receiver | string | (all receivers) | Send only to a specific Alertmanager receiver |
nself alerts list --severity warning --json | jq '.[].labels.alertname' -r |
xargs -I{} nself alerts silence {} --duration 2h --comment "Maintenance window"nself alerts list --severity critical --json | jq 'length'
# Returns 0 if no critical alerts firingnself alerts test HighDiskUsage --receiver slack-ops
# Sends a test message to your #ops Slack channelNSELF_ALERTMANAGER_URL — Alertmanager URL (default: http://127.0.0.1:9093)NSELF_PROMETHEUS_URL — Prometheus URL (default: http://127.0.0.1:9090)0 — success1 — Alertmanager or Prometheus not reachable2 — invalid arguments or unknown alert name