Schedule icon
Request icon
Publish icon
Switch icon
SlackIncomingWebhook icon
Fail icon
Log icon

VerneMQ MQTT Cluster Health and Queue Backlog Sentinel

Audit VerneMQ MQTT broker cluster health, detect queue message drops, execute synthetic publish probes, and alert on telemetry backlog spikes.

Categories
Infrastructure

VerneMQ is an enterprise-grade, distributed MQTT message broker designed for high-throughput IoT fleets, connected vehicle telemetry, and distributed messaging architectures. In high-volume production deployments, silent consumer disconnections, slow subscribers, or network partitions can lead to rapid message queue buildup, buffer exhaustion, and unhandled packet drops without crashing the broker process.

This blueprint implements an automated Sentinel that continuously verifies VerneMQ cluster health. It queries the broker Prometheus telemetry endpoint to detect queue message drops, dispatches a real synthetic MQTT publish probe to ensure TCP socket responsiveness and protocol compliance, and routes triage alerts via Slack when operational anomalies are detected.

How it works

  1. Scheduled Audit Trigger: Runs on a configurable 15-minute interval (*/15 * * * *), disabled by default for controlled onboarding and ad-hoc manual validation.
  2. Metrics Ingestion Probe: Issues an HTTP GET request to the VerneMQ telemetry endpoint (:8888/metrics) to retrieve real-time cluster health indicators and message drop counters.
  3. Synthetic Ingress Verification: Uses io.kestra.plugin.mqtt.Publish to deliver a QoS 1 JSON heartbeat message to a designated healthcheck topic, validating end-to-end TCP socket and broker ingestion paths.
  4. Condition Classification: Evaluates HTTP response codes and queue drop metrics within a flow-control Switch task, routing executions into BROKER_METRICS_UNAVAILABLE, QUEUE_DROP_SPIKE, or HEALTHY pathways.
  5. Slack Alert Dispatch: Delivers structured incident notifications to the designated Slack channel containing broker coordinates, threshold breaches, and actionable triage recommendations.
  6. Deterministic Failure & Audit: Terminates anomalous executions with io.kestra.plugin.core.execution.Fail to enforce SLA tracking, and emits a final audit log capturing execution telemetry.

What you get

  • Automated Queue Drop Detection: Early warning before slow MQTT subscribers cause memory pressure and telemetry loss.
  • Active Synthetic Monitoring: Validates that VerneMQ is actively accepting and routing MQTT connections, rather than relying solely on passive process checks.
  • Triage-Ready Incident Context: Formatted Slack notifications providing host coordinates, HTTP status codes, and threshold comparisons.
  • Declarative Observability: Zero daemon scripts or cron hacks required; everything is defined in auditable, version-controlled YAML.

Who it's for

  • IoT & Platform Engineers: Managing distributed VerneMQ clusters connected to smart meters, vehicles, or sensor fleets.
  • DevOps & SRE Teams: Responsible for MQTT broker uptime, cluster partition resilience, and message delivery SLAs.
  • Data Infrastructure Engineers: Maintaining streaming ingestion pipelines feeding Kafka, ClickHouse, or time-series databases.

Why orchestrate this with Kestra

  • Dual-Protocol Auditing: Orchestrates both HTTP REST metrics scraping and native TCP MQTT publish operations within a single unified flow.
  • Stateful Alert Routing: Branches deterministically using Pebble expressions without requiring external monitoring agents or bespoke sidecars.
  • Encrypted Secret Management: Protects Slack webhook URLs and broker credentials using native namespace secret injection.
  • Execution History & Replay: Maintains immutable audit logs of every health verification run for compliance and post-incident reviews.

Prerequisites

  • A running VerneMQ broker with the HTTP metrics plugin enabled (vmq_prometheus).
  • Network connectivity from the Kestra worker to the VerneMQ MQTT port (1883) and metrics port (8888).
  • An incoming webhook URL configured in your target Slack workspace.

Secrets

  • SLACK_WEBHOOK_URL: Target Slack incoming webhook URL for operational alerts and incident escalation (required).

Quick start

  1. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  2. Start a local VerneMQ container for testing: docker run -d --name vernemq -p 1883:1883 -p 8888:8888 -e DOCKER_VERNEMQ_ACCEPT_EULA=yes vernemq/vernemq:latest.
  3. Import this blueprint into Kestra and trigger an execution with default inputs.
  4. Confirm that the HTTP probe and synthetic MQTT publish task succeed, and verify execution logs in the Kestra UI.
  5. Enable the schedule trigger to establish automated 15-minute continuous monitoring.

How to extend

  • Consumer Verification: Pair with io.kestra.plugin.mqtt.Subscribe or RealtimeTrigger to measure round-trip message delivery latency.
  • Automated Remediation: Add tasks to automatically restart degraded subscriber pods or trigger queue drain jobs when drops are detected.
  • PagerDuty Escalation: Add io.kestra.plugin.pagerduty.notifications.PagerDutyAlert for high-severity cluster unavailability incidents.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.