Cloudflare alerting
You can use the Cloudflare data source with Grafana Alerting to create alert rules based on your Cloudflare data. This allows you to get notified when DNS query patterns change, response times increase, or other metrics exceed thresholds.
Before you begin
Ensure you have:
- Configured the Cloudflare data source
- Familiarity with Grafana Alerting
Supported query types for alerting
Alerting works best with time series queries that return numeric data. The following Cloudflare query types support alerting:
Note
Table-based queries like “DNS analytics report” and “List zones” are not suitable for alerting because they don’t return time series data.
Create an alert rule
Grafana supports two types of alert rules: Grafana-managed and data source-managed. Grafana-managed alert rules are evaluated by the Grafana alerting engine and can query any data source. Data source-managed alert rules are evaluated within the data source itself and require a compatible backend, such as Prometheus or Loki.
The Cloudflare data source supports only Grafana-managed alert rules. Because it queries the Cloudflare API rather than a Prometheus-style backend, you can’t use it to create data source-managed alert rules. For more information about the two types, refer to Alert rules.
To create an alert rule using the Cloudflare data source:
- Navigate to Alerting > Alert rules in the left menu.
- Click New alert rule.
- In the query section, select your Cloudflare data source.
- Configure a time series query (for example, DNS analytics by time).
- Define your alert condition using expressions (such as Reduce and Threshold).
- Configure labels, notifications, and other alert settings.
- Click Save rule.
For detailed instructions on creating alert rules, refer to Create Grafana-managed alert rules.
Alert examples
Example: Alert on high DNS query volume
To receive an alert when DNS query count exceeds a threshold:
- Create a new alert rule.
- Select the Cloudflare data source.
- Set Action to
DNS analytics by time. - Select your zone from Zone ID.
- In Metrics, select
Query Count. - Add a Reduce expression to calculate the average or last value.
- Add a Threshold expression to trigger when the value exceeds your limit (for example, > 10000).
- Configure notification settings and save.
Example: Alert on slow DNS response times
To receive an alert when average DNS response time increases:
- Create a new alert rule.
- Select the Cloudflare data source.
- Set Action to
DNS analytics by time. - Select your zone from Zone ID.
- In Metrics, select
Average response time. - Add a Reduce expression to calculate the average.
- Add a Threshold expression to trigger when response time exceeds your SLA (for example, > 100ms).
- Configure notification settings and save.
Example: Alert on DNS query drops
To receive an alert when DNS queries drop significantly (potential outage indicator):
- Create a new alert rule.
- Select the Cloudflare data source.
- Set Action to
DNS analytics by time. - Select your zone from Zone ID.
- In Metrics, select
Query Count. - Add a Reduce expression to calculate the average.
- Add a Threshold expression to trigger when the value drops below a baseline (for example, < 100).
- Configure notification settings and save.
Example: Alert on a rise in bot traffic
To receive an alert when automated (bot) traffic rises above a threshold, use a Radar time series query:
- Create a new alert rule.
- Select the Cloudflare data source.
- Set Action to
Get bot class timeseries. - Add a Reduce expression to calculate the last value of the bot series.
- Add a Threshold expression to trigger when the bot percentage exceeds your limit (for example, > 50).
- Configure notification settings and save.
Considerations for alerting
Keep the following in mind when you alert on Cloudflare data:
- Relative time range: Time series queries use the alert rule’s time range through the
${__timeFrom}and${__timeTo}variables. Set a relative range that contains data, such asnow-1htonow. - Data latency: Cloudflare analytics and Radar data can lag behind real time. To avoid alerts flapping into a No Data state, increase the evaluation interval or pending period, and set the rule’s No Data handling to match your needs.
- API rate limits: Frequent evaluations across many rules can reach Cloudflare API rate limits. Use a reasonable evaluation interval. If you see rate-limit errors, refer to Troubleshooting.


