nifectl alerts Command Reference
View and manage alerts and alert rules.
Overview​
The alerts commands show the alerts that nife.io raises for an organisation, let you acknowledge or resolve them, run a security scan on your clusters, and manage the alert rules that decide when an alert is raised. They use the same data as the Alerts page of the nife.io dashboard.
An alert has a status (firing, acknowledged or resolved) and a severity (critical, warning or info). Alert rules take their data from one of three sources: prometheus (the default), vm_instance or s3_site.
Subcommands​
| Subcommand | Description |
|---|---|
alerts list | List the alerts of an organization |
alerts history | List past alerts of an organization |
alerts security | List the alerts raised by security scans |
alerts ack | Acknowledge alerts |
alerts resolve | Resolve alerts |
alerts scan | Run a security scan now |
alerts rules | Manage alert rules |
nifectl alerts <subcommand> [flags]
Options​
--org string Slug of the organization (asked if you have more than one) (some subcommands)
-h, --help Help for alerts
Global Options​
-t, --access-token string Nife API Access Token
-j, --json JSON output format
-V, --verbose Verbose / debug output
alerts list​
List the alerts of an organization.
By default every alert is shown; use --status to see only the ones that need you.
Statuses: firing, acknowledged, resolved. Severities: critical, warning, info.
nifectl alerts list [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
--status string Show only alerts with this status: firing, acknowledged or resolved
--severity string Show only alerts of this severity: critical, warning or info
--limit int Most alerts to show (default 50)
Examples:
nifectl alerts list --org acme --status firing
nifectl alerts list --org acme --severity critical --limit 20
alerts history​
List past alerts of an organization.
List the alert history of an organization, a page at a time.
nifectl alerts history [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
--limit int Most alerts to show (default 50)
--offset int Number of alerts to skip
Examples:
nifectl alerts history --org acme --limit 25 --offset 25
alerts security​
List the alerts raised by security scans.
List the alerts raised by security scans of your clusters.
nifectl alerts security [flags]
Options:
--status string Show only alerts with this status: firing, acknowledged or resolved
--severity string Show only alerts of this severity: critical, warning or info
--limit int Most alerts to show (default 50)
Examples:
nifectl alerts security --status firing
alerts ack​
Acknowledge alerts.
Say that you are looking into one or more alerts.
nifectl alerts ack ALERT-ID...
Examples:
nifectl alerts ack 8f3c1a52-...
alerts resolve​
Resolve alerts.
Mark one or more alerts as fixed.
nifectl alerts resolve ALERT-ID...
Examples:
nifectl alerts resolve 8f3c1a52-...
alerts scan​
Run a security scan now.
Scan your clusters for security findings now. Findings become alerts and incidents.
nifectl alerts scan [flags]
Options:
--cluster string Scan only this cluster (default: every cluster)
Examples:
nifectl alerts scan
nifectl alerts scan --cluster my-cluster-id
alerts rules​
Manage alert rules.
Alert rules say when nife.io raises an alert.
| Subcommand | Description |
|---|---|
alerts rules list | List the alert rules of an organization |
alerts rules create | Create an alert rule |
alerts rules update | Change an alert rule |
alerts rules delete | Delete an alert rule |
nifectl alerts rules <subcommand> [flags]
alerts rules list​
List the alert rules of an organization.
nifectl alerts rules list [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
Examples:
nifectl alerts rules list --org acme
alerts rules create​
Create an alert rule.
Anything you leave out is asked for.
--conditionis the expression that fires the alert (PromQL for the default "prometheus" source).--severityis critical, warning (the default) or info.--sourceis prometheus (the default), vm_instance or s3_site.
nifectl alerts rules create [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
--name string Name of the rule
--description string What the rule is for
--condition string Expression that fires the alert (PromQL for the prometheus source)
--severity string critical, warning or info
--source string prometheus, vm_instance or s3_site
--disabled Create the rule switched off
Examples:
nifectl alerts rules create --org acme --name high-cpu \
--condition 'avg(rate(container_cpu_usage_seconds_total[5m])) > 0.9' --severity critical
alerts rules update​
Change an alert rule.
RULE is the rule's ID or its name. Only the things you pass are changed.
nifectl alerts rules update RULE [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
--name string Name of the rule
--description string What the rule is for
--condition string Expression that fires the alert (PromQL for the prometheus source)
--severity string critical, warning or info
--source string prometheus, vm_instance or s3_site
--enable Switch the rule on
--disable Switch the rule off
Examples:
nifectl alerts rules update high-cpu --org acme --severity warning
nifectl alerts rules update high-cpu --org acme --disable
alerts rules delete​
Delete an alert rule.
RULE is the rule's ID or its name. You are asked to confirm unless you pass --yes.
nifectl alerts rules delete RULE [flags]
Options:
--org string Slug of the organization (asked if you have more than one)
-y, --yes Accept all confirmations
Examples:
nifectl alerts rules delete high-cpu --org acme --yes
Best Practices​
- Start with
nifectl alerts list --status firingto see only the alerts that need you. - Acknowledge an alert as soon as you start working on it and resolve it once it is fixed.
ackandresolvetake several alert IDs at once. - Use
nifectl alerts rules update RULE --disableto silence a noisy rule without deleting it. - Pass
--yestoalerts rules deletein scripts so it does not wait for a confirmation.
See Also​
nifectl incidents– Open and resolve incidentsnifectl integrations– Send alerts to Slack, PagerDuty, email and SMSnifectl– The Nife CLI home command
Summary​
Nifectl Alerts puts the Alerts page of the dashboard on the command line — see what is firing, take ownership of it, and tune the rules behind it.