5.02L Create alert rule - MartinWong06/grafana GitHub Wiki
-
Navigate to the dashboard where you want to create an alert rule.
-
Click on the bell icon on the top-right corner of the screen.
-
Select "Notification channels" to create a notification channel (e.g., email, Slack, PagerDuty, etc.) to receive alerts.
-
After creating the notification channel, click on "Create rule".
-
In the "Rule" tab, give a name to your rule and select the data source from which you want to generate alerts.
-
Define the condition for the alert, e.g., "If the CPU usage is above 90% for the last 5 minutes".
-
Select the evaluation time and the frequency at which you want to check for the condition.
-
In the "Notifications" tab, select the notification channel you created earlier to receive alerts.
-
Click on "Save rule" to save the alert rule.
Here is a sample alert rule query:
sum(rate(http_requests_total{status="500"}[5m])) by (job) > 10
This alert rule will trigger an alert if the rate of HTTP requests with a status code of 500 is greater than 10 per second, grouped by job, over the last 5 minutes.