This is documentation for the next version of Grafana documentation. For the latest stable release, go to the latest version.
InfluxDB alerting
You can use Grafana Cloud to avoid installing, maintaining, and scaling your own instance of Grafana. Create a free account to get started, which includes free forever access to 10k metrics, 50GB logs, 50GB traces, 500VUh k6 testing & more.
You can use Grafana Alerting with InfluxDB to create alerts based on your time-series data. This allows you to monitor metrics, detect anomalies, and receive notifications when specific conditions are met.
For general information about Grafana Alerting, refer to Grafana Alerting.
Before you begin
Before creating alerts with InfluxDB, ensure you have:
- An InfluxDB data source configured in Grafana
- Appropriate permissions to create alert rules
- Understanding of the metrics you want to monitor
Supported query types
InfluxDB alerting supports all three query languages: InfluxQL, SQL, and Flux. Queries must return time-series data for Grafana to evaluate values over time and trigger alerts when thresholds are crossed.
Query language compatibility
Create an alert rule
To create an alert rule using InfluxDB:
- Navigate to Alerting > Alert rules.
- Click New alert rule.
- Enter a name for the alert rule.
- Select your InfluxDB data source.
- Build your query using the query editor.
- Configure the alert condition (for example, when the average is above a threshold).
- Set the evaluation interval and pending period.
- Configure notifications and labels.
- Click Save rule.
For detailed instructions, refer to Create a Grafana-managed alert rule.
Example alert queries
The following examples show common alerting scenarios with InfluxDB.
InfluxQL: Alert on high CPU usage
Monitor CPU usage and alert when it exceeds a threshold:
- Query: Select the
cpumeasurement withmean("usage_system")as the aggregation. - GROUP BY:
time($__interval) - Condition: When mean is above 90.
In raw query mode:
SELECT mean("usage_system") FROM "cpu" WHERE $timeFilter GROUP BY time($__interval) fill(null)Flux: Alert on memory pressure
Monitor memory usage with a Flux query:
from(bucket: "telegraf")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "mem")
|> filter(fn: (r) => r["_field"] == "used_percent")
|> aggregateWindow(every: v.windowPeriod, fn: mean)
|> yield(name: "mean")Set the condition to alert when the mean value exceeds 85.
SQL: Alert on disk usage
Monitor disk usage with an SQL query:
SELECT $__dateBin(time), mean(used_percent)
FROM disk
WHERE $__timeFilter(time)
GROUP BY $__dateBin(time)Set the condition to alert when the mean value exceeds 80.
Limitations
When using InfluxDB with Grafana Alerting, be aware of the following limitations:
Template variables not supported
Alert queries can’t contain template variables. Grafana evaluates alert rules on the backend without dashboard context, so variables like $hostname or $region aren’t resolved.
If your dashboard query uses template variables, create a separate query for alerting with hard-coded values.
Query complexity
Complex queries with many nested functions or large result sets may timeout or fail to evaluate. Simplify queries for alerting by:
- Reducing the time range
- Using appropriate aggregation intervals
- Adding filters to limit the data scanned
Best practices
Follow these best practices when creating InfluxDB alerts:
- Use specific filters: Add WHERE clauses or Flux filters to focus on relevant data and improve query performance.
- Choose appropriate intervals: Match the GROUP BY time interval to your evaluation frequency.
- Test queries first: Verify your query returns expected results in Explore before creating an alert.
- Set realistic thresholds: Base alert thresholds on historical data patterns.
- Use meaningful names: Give alert rules descriptive names that indicate what they monitor.
If you encounter errors when creating or evaluating alert rules, refer to Troubleshoot InfluxDB data source issues.


