docs/sources/datasources/google-cloud-monitoring/alerting/index.md
The Google Cloud Monitoring data source supports Grafana Alerting, allowing you to create alert rules based on GCP metrics and Service Level Objectives (SLOs). You can monitor your Google Cloud environment and receive notifications when specific conditions are met.
Before you create alert rules, ensure the following:
The following query types support alerting:
| Query type | Use case | Notes |
|---|---|---|
| Builder | Threshold-based alerts on GCP resource metrics | Best suited for alerting; returns time-series data |
| MQL | Complex metric queries using Monitoring Query Language | Use for advanced filtering and aggregations |
| Service Level Objectives (SLO) | Alert on SLO compliance, error budgets, or burn rate | Monitor service reliability |
| PromQL | Prometheus-style queries on GCP metrics | Familiar syntax for Prometheus users |
{{< admonition type="note" >}} Alert queries must return numeric data that Grafana can evaluate against a threshold. Queries that return only text or non-numeric data can't be used directly for alerting. {{< /admonition >}}
Alerting rules run as background processes without a user context. Both supported authentication methods work with alerting:
| Authentication method | Supported |
|---|---|
| Google JWT File | ✓ |
| GCE Default Service Account | ✓ |
To create an alert rule using Google Cloud Monitoring data:
For detailed instructions, refer to Create a Grafana-managed alert rule.
This example creates an alert that fires when Compute Engine VM CPU utilization exceeds 80%:
instance/cpu/utilizationThis example alerts when an SLO's error budget remaining drops below 20%:
This example alerts when Cloud SQL instance memory usage exceeds 90%:
database/memory/utilizationFollow these recommendations to create reliable and efficient alerts with Google Cloud Monitoring data.
When your query returns multiple time series (for example, CPU usage across multiple VMs), use the Reduce expression to aggregate them:
For alerting queries, ensure the alignment period provides enough data points:
Configure what happens when no data is returned:
Always verify your query returns expected data before creating an alert:
The Google Cloud Monitoring data source supports Grafana-managed recording rules. Recording rules periodically pre-compute frequently used or computationally expensive queries, saving the results as a new time series metric.
Use recording rules to:
{{< admonition type="note" >}} Grafana-managed recording rules write results to a Prometheus-compatible database (such as Grafana Mimir or the Grafana Cloud managed Prometheus). You must configure a target data source for storing the recorded metrics. {{< /admonition >}}
For instructions on creating recording rules, refer to Create recording rules.
If your Google Cloud Monitoring alerts aren't working as expected, use the following sections to diagnose and resolve common issues.
If you see authentication errors when alerts evaluate:
For additional troubleshooting help, refer to Troubleshoot Google Cloud Monitoring.