تخطَّ إلى المحتوى

nself alerts

هذا المحتوى غير متوفر بلغتك بعد.

Manage Prometheus alert rules and silences.

nself alerts <subcommand> [flags] [args]

nself alerts lists configured Prometheus alert rules, silences alerts for a window, and fires synthetic test alerts to validate routing through Alertmanager. It is the operator-facing wrapper for the monitoring stack provisioned by nself (Prometheus + Alertmanager).

alerts list reads the bundled rule set and prints each rule with its severity (P1, P2, P3), for duration, summary, and PromQL expression. alerts silence posts a silence to Alertmanager with a duration and required reason. alerts test injects a synthetic firing alert through the Alertmanager API so on-call rotation, notification channels, and dashboards can be exercised end-to-end.

Use this command after editing alert rules or when validating that paging integrations (PagerDuty, Slack, email) are wired correctly.

NameDescription
listList all configured alert rules
silence <alert-name>Silence an alert for a specified duration
test <alert-name>Fire a synthetic test alert
FlagDefaultDescription
--severity""Filter by severity (P1, P2, P3)
--jsonfalseJSON output
FlagDefaultDescription
--duration2hSilence duration (e.g. 2h, 30m)
--reason""Reason for silencing (required)
FlagDefaultDescription
--alertmanager-url""Alertmanager URL (default: http://127.0.0.1:9093)
Terminal window
# List all alert rules
nself alerts list
# List only critical (P1) rules as JSON
nself alerts list --severity P1 --json
# Silence the HighErrorRate alert for 4 hours during deploy
nself alerts silence HighErrorRate --duration 4h --reason "scheduled deploy"
# Fire a test alert so on-call rotation can verify routing
nself alerts test HighErrorRate

Commands | Home