Ceph RBD Snapshot Protection Gate
List an RBD image's snapshots via the Ceph Dashboard API and alert Slack on any that are not protected, read-only.
Monitor manufacturing downtime from MQTT events, query machine stop history in PostgreSQL, classify long stops with Gemini AI, and alert operators in Slack.
This blueprint automates the root-cause analysis of machine downtime in manufacturing environments. When a production line stops (triggered by an MQTT event from a PLC or sensor), the workflow:
plant/filler1/stops).plant/+/stops for machine stop events (JSON payloads).{
"machine_id": "filler1",
"line": "CSD3",
"reason_code": "LOW_PRESSURE",
"duration_min": 7
}
The Gemini ChatCompletion receives the current stop, the machine's recent stop history, and generates:
Includes machine ID, line, duration, reason code, and the AI-generated summary, formatted as a rich Block Kit message.
Use the included docker-compose.yml to spin up a local MQTT broker and Postgres:
cd kestra-dev/
docker compose up -d
This starts:
localhost:1883localhost:5433 (user: plant, password: plant, db: plant)In the Kestra UI, add the following namespace secrets (or set as environment variables prefixed SECRET_):
| Secret | Example | Source |
|---|---|---|
PLANT_DB_USER |
plant |
Postgres username |
PLANT_DB_PASSWORD |
plant |
Postgres password |
GEMINI_API_KEY |
AIza... |
Google AI Studio |
SLACK_WEBHOOK_URL |
https://hooks.slack.com/... |
Slack App incoming webhook |
Deploy MQTT + Postgres:
cd kestra-dev/
docker compose up -d
Add secrets to Kestra (Namespace → Secrets):
PLANT_DB_USER = plantPLANT_DB_PASSWORD = plantGEMINI_API_KEY = your API keySLACK_WEBHOOK_URL = your Slack webhookCopy both flows (downtime-root-cause-triage.yaml and simulate-machine-stops.yaml) into the Kestra editor under the company.team namespace.
Trigger a test:
simulate-machine-stops, which publishes two MQTT events (a 7-min stop and a 1-min stop).is_long_stop branches on the 7-minute stop (goes to then, runs AI).is_long_stop evaluates to false on the 1-minute stop (goes to else, just logs).downtime_log.Inspect outputs:
analyze task to see the AI-generated summary.alert to confirm the Slack message was sent.long_stop_minutes (default 2) to change the cutoff for AI analysis.history_limit (default 10) to give Gemini more historical context.ManufacturingIoTMQTTAIPostgresSlackEvent-DrivenReliability Engineering