Set alert conditions
The alert condition defines when your alert fires. You’ll set a threshold that, when crossed, triggers the alert. For multi-dimensional queries, each series is evaluated independently—so one rule can generate alerts for multiple hosts or services.
To set your alert conditions, complete the following steps:
In the Define query and alert condition section, scroll to the Expressions area.
Grafana automatically adds a Reduce expression and a Threshold expression to process your query results.
Configure the Reduce expression:
Function: Select how to reduce the time series to a single value.
For example, select
Lastto use the most recent value, orMeanto use the average over the evaluation window.Input: Should reference your query (typically
A).
Configure the Threshold expression:
Input: Should reference your Reduce expression (typically
B).Condition: Select the comparison operator.
Value: Enter your threshold value.
Click Preview to test your condition against current data.
The preview shows which series would currently fire (if any) based on your threshold. Use this to validate your threshold is appropriate.
Adjust the threshold if needed based on the preview results.
Tip: A good threshold gives you time to respond before the situation becomes critical. For metrics, if your normal CPU is 40-60%, alerting at 80% gives you warning. For logs, if your app normally logs 1-2 errors per minute, alerting at 10 catches real problems.
In the next milestone, you’ll configure how often Grafana evaluates this condition and how long it must persist before firing.
At this point in your journey, you can explore the following paths:
