New to Kestra?
Use blueprints to kickstart your first workflows.
Audit InfluxDB series cardinality across telemetry buckets with Kestra. Detect tag explosion and high-cardinality bursts before TSDB memory exhaustion.
Time-series databases like InfluxDB rely on inverted index structures (TSI) to store and query metrics efficiently. In production telemetry and IoT ingestion pipelines, high-entropy fields such as user IDs, request UUIDs, container IP addresses, or unparsed URLs are occasionally mistakenly indexed as tags rather than stored as field values. This creates millions of unique time series keys in minutes, a condition known as series cardinality explosion. Runaway cardinality causes exponential TSI index memory consumption, severe compaction delays, query timeouts, and unrecoverable out-of-memory (OOM) crashes across InfluxDB storage nodes.
This blueprint implements an automated Day 2 Operations sentinel that queries InfluxDB on a recurring schedule. It runs a Flux aggregation across target telemetry buckets to identify measurements with the highest active series volume, evaluates peak series counts against cardinality thresholds, and automatically dispatches Slack incident alerts with root-cause measurement telemetry to prevent TSDB cluster degradation.
periodic_cardinality_audit (io.kestra.plugin.core.trigger.Schedule) triggers the audit pass every 4 hours (disabled by default for initial setup).probe_series_cardinality (io.kestra.plugin.influxdb.FluxQuery) connects to InfluxDB via its native Flux API, scanning the target bucket over the configured lookback window, grouping by measurement and field, and sorting descending to return the top 5 highest series measurements.evaluate_cardinality (io.kestra.plugin.core.flow.Switch) evaluates whether the peak measurement series count exceeds max_series_threshold.HEALTHY), log_cardinality_healthy records the measurement name, series count, and healthy status.SURGE_DETECTED), alert_cardinality_surge dispatches an operational incident alert to Slack using io.kestra.plugin.slack.notifications.SlackIncomingWebhook, and log_remediation_guidance logs actionable isolation instructions.log_audit_completion writes a final audit recap for execution tracking and audit lineage.errors block alerts Slack immediately if InfluxDB authentication or network connectivity fails.Monitoring InfluxDB cardinality using detached cron jobs or external scripts requires managing client libraries, credential rotation, error handling, and notification webhooks in brittle custom code. Kestra provides a declarative workflow engine with native InfluxDB Flux support, centralized secret management, conditional branching, execution history, and native Slack alerting without operating dedicated monitoring daemons.
To run InfluxDB locally for development and testing without host port conflicts:
docker run -d --name influxdb-dev -p 8086:8086 \
-e DOCKER_INFLUXDB_INIT_MODE=setup \
-e DOCKER_INFLUXDB_INIT_USERNAME=admin \
-e DOCKER_INFLUXDB_INIT_PASSWORD=adminpassword123 \
-e DOCKER_INFLUXDB_INIT_ORG=company-infra \
-e DOCKER_INFLUXDB_INIT_BUCKET=telemetry \
-e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token \
influxdb:2.7-alpine
If Kestra is running inside a Docker network, connect the InfluxDB container to Kestra's network:
docker network ls
docker network connect YOUR_KESTRA_NETWORK influxdb-dev
INFLUXDB_TOKEN: API token permitted to execute Flux queries in the target InfluxDB organization.SLACK_WEBHOOK: Incoming Webhook URL for Slack alerting.Note for Kestra Open-Source (OSS): Secrets are configured as base64-encoded environment variables formatted as
SECRET_<NAME>(e.g.SECRET_INFLUXDB_TOKEN).
| Name | Type | Default | Allowed Values | Description |
|---|---|---|---|---|
influxdb_host |
STRING | "http://localhost:8086" |
Valid HTTP/S URL | InfluxDB API endpoint |
influxdb_org |
STRING | "company-infra" |
String identifier | InfluxDB organization name |
target_bucket |
STRING | "telemetry" |
Valid bucket name | Bucket inspected for cardinality |
lookback_window |
STRING | "1h" |
Valid Flux duration (15m, 1h, 6h) |
Aggregation time window |
max_series_threshold |
INT | 50000 |
Positive integer | Maximum allowable series per measurement |
remediation_mode |
SELECT | "ALERT_ONLY" |
"ALERT_ONLY", "LOG_REMEDIATION" |
Action mode on cardinality breach |
{{ outputs.probe_series_cardinality.rows }}: List of top measurement records containing _measurement, _field, and _value (series count).{{ outputs.probe_series_cardinality.size }}: Total number of measurement summary rows returned by the Flux query.INFLUXDB_TOKEN and SLACK_WEBHOOK in your Kestra namespace secrets.inputs.target_bucket set to your telemetry bucket to verify connectivity and series aggregation.periodic_cardinality_audit schedule trigger to run automated recurring audits.schema.tagKeys()) and identify the exact high-cardinality tag.SURGE_DETECTED branch for critical production cluster alerts.io.kestra.plugin.core.flow.Subflow to filter out unbounded tag dimensions at the ingestion edge.lookback_window focused (e.g., 15m to 1h) for high-frequency time series data.io.kestra.plugin.influxdb.InfluxQLQuery with SHOW SERIES CARDINALITY syntax instead.localhost.