Create a Grafana Mimir or Loki managed alerting rule
Verify that you have write permission to the Prometheus or Loki data source. Otherwise, you will not be able to create or update Grafana Mimir managed alerting rules.
For Grafana Mimir and Loki data sources, enable the ruler API by configuring their respective services.
Grafana Mimir - use the , not
/prometheus
. The Prometheus data source supports both Grafana Mimir and Prometheus, and Grafana expects that both the Query API and are under the same URL. You cannot provide a separate URL for the Ruler API.
Watch this video to learn more about how to create a Mimir managed alert rule:
Add a Grafana Mimir or Loki managed alerting rule
- Click New alert rule. The new alerting rule page opens where the Grafana managed alerts option is selected by default.
- In Step 1, select Mimir or Loki alert option.
- Next, select your Loki or Prometheus data source and add the query to evaluate.
- Enter a PromQL or LogQL expression to query. The rule fires if the evaluation result has at least one series with a value that is greater than 0. An alert is created for each series.
In Step 2, specify the alert evaluation interval.
In the For text box, specify the duration for which the condition must be true before an alert fires. If you specify , the condition must be true for 5 minutes before the alert fires.
- Next, create a for the rule.