Creating an Alert Rule in Grafana
EveryoneMLOps essentials
stand: 2024-06-09
Overview
This guide provides step-by-step instructions for creating an alert rule in GRACE using Grafana. You will learn how to select a dashboard panel, define alert conditions, configure notifications, and verify your alert setup.
1. Navigate to the Desired Dashboard
- Log in to Grafana.
- Go to: Dashboard Builder → Dashboard.
- Select the dashboard you want to monitor, for example:
Kubernetes / Views / Pods. - Set the filters:
- Namespace =
project-$NAME_OF_YOUR_PROJECT(e.g.,project-aak) - Pod name = e.g.,
d-tool-chat-app-aak-*(your application pod)
- Namespace =
2. Make the Dashboard Editable
- In the top-right corner of the dashboard, click Make editable.
3. Select the Panel for Your Alert
- Choose the panel you want to monitor, for example: Memory Usage by container.
- Note: A pod may contain multiple containers.
4. Create a New Alert Rule
- In the top-right corner of the panel, click the three dots menu.
- Select More → New Alert Rule.
5. Configure the Alert Rule
You will be taken to the alert rule configuration screen.
Step 5.1: Name the Alert Rule
- Example:
tool memory usage
Step 5.2: Define the Alert Condition
- Set the condition type: WHEN QUERY is above.
- Enter the threshold value (in bytes), e.g.,
90000000. - Click Preview alert rule condition to verify which containers trigger the alert.
Step 5.3: Add Folder and Labels
- Create a folder for organizing alerts:
- Click New Folder → Enter name (e.g.,
project-aak).
- Click New Folder → Enter name (e.g.,
Step 5.4: Set Evaluation Behaviour
- Click New evaluation group.
- Enter a name for the group.
- Set the Evaluation interval (how often rules are checked), e.g.,
1m. - Click Create.
Step 5.5: Configure Notifications
- In the Notification policies section, select the contact point you created earlier (e.g.,
testemail contact).
Step 5.6: Configure Notification Message
- Add a descriptive message to help identify why the alert was triggered.
6. Save the Alert Rule
- Click Save rule and exit in the top-right corner.
7. Verify the Alert
- Ensure the alert triggers when the defined condition is met.
- Check that notifications are sent to the configured contact point.