We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Alerting

Logging and dashboards are mostly reactive. You inspect them after something suspicious happens.

Alerting is different: it tells you when a condition is bad right now.

There are many alerting tools out there, but you usually want them tied into your metrics monitoring system – so we'll be using Grafana again!

Metrics-Based Alerts

We'll start with a deliberately noisy alert to prove the full flow works:

  • query a metric
  • evaluate a threshold
  • see the rule transition from Normal to Pending to Firing

Assignment

Create a noisy alert that fires when the HTTP 401 response rate exceeds 3 requests/minute (calculated over the last 5 minutes).

  1. sum(rate(http_requests_total{status="401"}[5m])) * 60
    
    • Set the "Evaluation interval" (how often the rule checks the condition) to 10 seconds
    • Set the "pending period" (the duration the rule has to be in a bad state before it transitions to "firing") to None
    • The "keep firing for" (the duration the rule will stay in "firing" before it goes back to "normal") should also be None

Run and submit the CLI tests from the root of the Linko repo.

The tests will take around 30 seconds to run because they allow some time for the alert to transition to Firing.