Grafana Cloud provides powerful alerting capabilities that help you monitor your systems and get notified when issues arise. In this guide, we'll walk through setting up Grafana Cloud and configuring alerts for container monitoring.
Prerequisites
A Grafana Cloud account
Docker containers running that you want to monitor
Basic understanding of metrics and alerting concepts
Step 1: Accessing Grafana Cloud
After signing up for Grafana Cloud, you'll be greeted with a dashboard showing several options:
Demo Data
Account Usage
Sandbox Account
Connect your data
Step 2: Navigating to Alert Rules
In the left sidebar, navigate to "Alerts & IRM" → "Alerting" → "Alert rules"
Initially, you'll see an empty alert rules page with options to create new rules
Step 3: Creating a New Alert Rule
Click the "New alert rule" button to start configuring your alert. You'll need to:
Enter an alert rule name
Define query and alert conditions
Add folder and labels
Set evaluation behavior
Step 4: Configuring the Alert
In the alert configuration:
Metric Selection
Choose your data source (like grafanacloud-[yourname]-prom)
Select the metric: container_cpu_usage_seconds_total
Add appropriate label filters
Alert Conditions
Set "WHEN QUERY IS ABOVE" threshold
In our example, we're monitoring CPU usage
Configure the evaluation period
Step 5: Setting Evaluation Behavior and Organization
[Insert Image 5: Alert Rules List] The Alert Rules list showing the newly created CPU Evaluation alert in the Testing folder.
Configure how your alert will be evaluated:
Add to the "Testing" folder
Create "CPU Evaluation" category
Set evaluation interval to 5m
Configure pending period
Step 6: Verifying Alert Setup
After setting up the alert, verify:
Alert name and description
Evaluation period (5m)
Current state (Normal)
Health status (OK)
Dashboard UID and Panel ID
Step 7: Monitoring Dashboard
The CPU Usage dashboard displays:
Real-time usage metrics
Historical trends
Container-specific data
Usage patterns over time
Best Practices
Alert Thresholds
Set reasonable thresholds based on your application's behavior
Consider historic patterns when setting limits
Avoid alert fatigue by not setting thresholds too low
Evaluation Periods
Use appropriate evaluation periods (5m is standard)
Consider your application's behavior when setting pending periods
Balance between quick alerts and avoiding false positives
Organization
Use clear, descriptive names for alerts
Organize alerts into logical folders
Add relevant labels for better searchability
Conclusion
With these steps completed, you now have a functional Grafana Cloud alerting system that monitors your container's CPU usage and alerts you when thresholds are exceeded. This setup provides a solid foundation for expanding your monitoring and alerting capabilities as needed.
Remember to regularly review and adjust your alert thresholds and evaluation criteria based on your application's actual behavior and your team's needs.