New to Kestra?
Use blueprints to kickstart your first workflows.
Monitors HashiCorp Nomad client allocations for rapid reschedule loops, detecting crashing jobs and alerting SRE teams on Slack.
In distributed workload environments running HashiCorp Nomad, misconfigured batch jobs, failing container health checks, or node out-of-memory (OOM) evictions can cause task allocations to enter continuous restart loops.
When Nomad's reschedule stanza is configured with aggressive backoff parameters without maximum retry ceilings, the Nomad scheduler repeatedly relocates failing allocations across client nodes in rapid succession. This behavior creates an allocation reschedule storm: client nodes spend excessive CPU cycles pulling Docker images, mounting volumes, and allocating ephemeral ports, quickly exhausting host compute capacity and degrading co-located production workloads.
This blueprint provides an automated orchestration safety guard. Running on a recurrent ten-minute schedule, it interrogates the Nomad Allocations API, counts recent reschedule events and task failure frequencies, evaluates metrics against safe thresholds, and notifies SRE on-call engineers via Slack with exact diagnostic commands.
audit_nomad_allocations trigger (io.kestra.plugin.core.trigger.Schedule) initiates the audit every ten minutes.scan_rescheduled_allocations task (io.kestra.plugin.scripts.python.Script) queries /v1/allocations, parsing RescheduleTracker events and identifying tasks undergoing repeated restart cycles.evaluate_reschedule_storm flowable task (io.kestra.plugin.core.flow.If) evaluates whether total reschedule bursts or flapping allocations exceed safe limits.notify_slack_nomad_storm (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) delivers an actionable incident card detailing the top failing job, client node, and exact CLI diagnostic commands (nomad alloc logs, nomad job stop).log_healthy_nomad_cluster logs nominal cluster stability.export_nomad_reschedule_manifest task records execution state for platform telemetry archives.flowchart TD
A[Schedule: Every 10 Minutes] --> B[scan_rescheduled_allocations: Nomad Allocations API]
B --> C{Reschedule Storm Detected?}
C -- Yes --> D[notify_slack_nomad_storm: Slack Webhook]
C -- No --> E[log_healthy_nomad_cluster: Log]
D --> F[export_nomad_reschedule_manifest: Return JSON]
E --> F
| Name | Type | Default | Description |
|---|---|---|---|
nomad_addr |
STRING | "http://localhost:4646" |
Base URL of the HashiCorp Nomad server cluster API endpoint. |
max_reschedules_threshold |
INT | 10 |
Maximum allowable reschedule events across jobs within the window. |
evaluation_window_minutes |
INT | 15 |
Time window in minutes to inspect allocation lifecycle reschedule events. |
slack_channel |
STRING | "#sre-orchestration-alerts" |
Slack channel destination for workload orchestration incident notifications. |
{{ outputs.scan_rescheduled_allocations.vars.has_reschedule_storm }}: Boolean flag indicating if an active reschedule storm exists.{{ outputs.scan_rescheduled_allocations.vars.total_reschedules }}: Total count of allocation reschedule events detected.{{ outputs.scan_rescheduled_allocations.vars.flapping_count }}: Number of distinct allocations undergoing flapping behavior.{{ outputs.scan_rescheduled_allocations.vars.top_job }}: Name of the job experiencing the highest restart volume.{{ outputs.scan_rescheduled_allocations.outputFiles['nomad_reschedule_audit.json'] }}: Complete JSON diagnostic report.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL with permissions to post messages.SLACK_WEBHOOK_URL in your Kestra namespace secrets.nomad_addr with your cluster URL (e.g., https://nomad.prod.internal:4646).X-Nomad-Token HTTP header in requests.job.trash_after); ensure your query filter targets recent events rather than historical completed jobs.PUT /v1/job/<job-id>/pause to quarantine flapping jobs automatically during severe storms.