Alert on vulnerabilities ¶

Use Nais workload metrics to alert your team when vulnerabilities exceed your chosen thresholds. Each vulnerability is counted once per workload and canonical ID, using its highest severity. Suppressed vulnerabilities are excluded.

Use max, not sum, across replicas: each replica exports counts for the same workloads.

Prerequisites ¶

Alert on critical vulnerabilities ¶

Create a PrometheusRule in your namespace that triggers an alert when the number of critical vulnerabilities exceeds zero.

.nais/alert-vulnerabilities.yaml
yaml

Alert on known exploitation ¶

Use nais_workload_vulnerabilities_kev to alert on vulnerabilities listed in the CISA KEV catalog .

The KEV series is absent until the catalog is loaded. An absent series does not mean zero known exploited vulnerabilities.

.nais/alert-kev-vulnerabilities.yaml
yaml

Activate alerts ¶

Add the rule file to your application repository and deploy it with Nais GitHub Action.

Apply the rule file you created, for example:

bash

Send alerts to a dedicated Slack channel ¶

By default, alerts are sent to your team's standard Slack channel. If you want to send vulnerability alerts to a dedicated channel, create an AlertmanagerConfig.

See Advanced Prometheus alerting for a complete example with a custom Slack channel and webhook.

Create alerts in Grafana ¶

Alternatively, you can create alerts directly in Grafana without deploying Kubernetes resources:

  1. Open Grafana and go to Alerting → Alert rules
  2. Click New alert rule
  3. Select the Prometheus/Mimir data source that contains nais_workload_* metrics and use e.g.:
    promql
  4. Set the threshold and connect to a Slack contact point

See Create alert in Grafana for a complete step-by-step guide.

Check metric coverage ¶

Check scan coverage in Nais Console before treating a missing series as a clean workload. Workloads without a scanned image have no series. Scanned workloads export all five severity values (CRITICAL, HIGH, MEDIUM, LOW, UNKNOWN), including zeros.

Metric update delay

New scans and suppressions appear in metrics at the next successful refresh, up to 5 minutes later, plus normal metrics propagation time. Alerts clear only after Prometheus collects the updated metrics. New advisories appear after the next vulnerability database update and rescan, followed by a metrics refresh.

Learn more ¶