Use PromQL to create alerting policies

This page describes how you can create PromQL-based alerting policies in Cloud Monitoring. You can use PromQL queries to create complex conditions with features such as ratios, dynamic thresholds, and combined metrics.

If you use Prometheus in environments outside Google Cloud, or if you use alerting in Managed Service for Prometheus, then you can migrate your Prometheus alerting rules to PromQL-based alerting policies. This way, you can manage all of your alerting policies in Cloud Monitoring.

You can also import Grafana dashboards into Cloud Monitoring.

Use PromQL in Cloud Monitoring alerting policies

You can create PromQL-based alerting policies in the following ways:

Incidents created by a PromQL-based alerting policy appear in the Google Cloud console with your other incidents. You can interact with these incidents in the Google Cloud console.

The conditions of your PromQL-based alerting policy can reference any metric in Cloud Monitoring, including Google Cloud system metrics, custom and log-based metrics, and Prometheus metrics. You must translate the names of non-Prometheus metrics to PromQL metric syntax. For more information, see Mapping Monitoring metrics to PromQL.

Restrictions

A PromQL-based alerting policy can have a retest window of at most 24 hours and an alignment period of at most 24 hours. The sum of the retest window and alignment period must be at most 25 hours.

If your Prometheus alerting rule references a metric, then you must first have an equivalent metric descriptor in Cloud Monitoring before creating your PromQL-based alerting policy. However, you can override this validation by configuring your PromQL-based alerting policy with the Cloud Monitoring API. For more information, see Disable check for metric existence.

Pricing

In general, Cloud Monitoring system metrics are free, and metrics from external systems, agents, or applications are not. Billable metrics are billed by either the number of bytes or the number of samples ingested.

For more information about Cloud Monitoring pricing, see the following documents: