Snort Packet Processing Stall and Rule Eval Timeout Sentinel
Monitors Snort 3 IDS engine telemetry to detect DAQ buffer drops, inspection thread stalls, and regex rule evaluation timeouts.
Find running Docker containers whose healthcheck reports unhealthy, restart them behind an approval, then re-check health and fail if any stays unhealthy.
A container with a HEALTHCHECK can be up and failing at the same time. After the configured
number of consecutive failed checks the daemon marks it unhealthy, but the process never
exited, so a restart policy never fires. Restart policies act on exit, not on health. The
daemon keeps reporting the container as running. A load balancer may keep routing to it. It sits
there serving errors. Nothing restarts it.
This blueprint restarts it, inside a boundary you set. It reads the health status of every
container carrying a label you apply yourself, keeps a protect-list, caps how many go in one
run, then runs docker restart on each unhealthy one behind a dry run and an approval. It waits
one settle window for the healthcheck to run again, inspects every target once more, then fails
the run if any target is still unhealthy.
This blueprint was created by zkasuran.
Restarting a container interrupts what it is serving, so the flow is built so it cannot reach anything but its own target:
label_selector, so a container without that label is never returned, let alone restarted. The label is one you apply to the containers you want this flow to manage.HEALTHCHECK has no health to act on, so it is read and kept, never a target.protected_name_pattern wins over every other rule. A stateful service you do not want bounced mid-recovery stays untouched even when it is unhealthy.max_restarts bounds one run, so a selector that matches more than you expected cannot bounce a whole host in one execution.docker_host over the Engine API and the restart goes to the same endpoint through DOCKER_HOST. The flow holds no socket path and no hostname of its own, so the daemon that runs Kestra is never a target.auto_remediate true, dry_run false, then an approved Pause. The shipped defaults and the disabled schedule are read-only.starting right after a restart, so the re-check waits settle_seconds for the healthcheck to run again before it decides pass or fail.list_labelled (io.kestra.plugin.core.http.Request, read-only) asks the Docker Engine API for running containers matching label_selector. The Docker plugin has no container list task, so the inventory comes from the API. candidates keeps the ids and names.
inspect_each (io.kestra.plugin.core.flow.Loop, read-only) inspects each candidate. State.Health.Status, State.Health.FailingStreak and the last healthcheck output are in the inspect payload only, not in the list.
assess gives every candidate a verdict:
KEEP_NO_HEALTHCHECK: no HEALTHCHECK, so there is no health to act on;KEEP_PROTECTED: its name matches protected_name_pattern;KEEP_HEALTHY: the healthcheck reports healthy;KEEP_STARTING: the healthcheck has not settled yet;KEEP_OVER_CAP: unhealthy, but beyond max_restarts for this run;RESTART: running, has a healthcheck, reports unhealthy, unprotected, inside the cap.summary logs the counts and every target with its failing streak.
route stops with a log line when nothing is unhealthy. Otherwise findings_alert posts the plan to Slack and remediate_gate checks auto_remediate and dry_run.
hold (io.kestra.plugin.core.flow.Pause) waits for approval. remediate_restart (Loop, concurrencyLimit: 1) then runs one docker restart per target through io.kestra.plugin.scripts.shell.Commands on the docker:27-cli image, pointed at docker_host by DOCKER_HOST.
settle (io.kestra.plugin.core.flow.Sleep) waits settle_seconds so the healthcheck runs again. reverify_each inspects every target again by name. result sorts them into recovered, still unhealthy, still starting and gone. verify fails the run if any target did not come back to healthy.
errors alerts Slack when the flow fails, including when the verification gate fails.
docker ps both miss.A cron job can run docker restart across a host, but it cannot read the health status first, cannot keep a protect-list, cannot stop at a ceiling, cannot wait for an approval and cannot check that the restart actually fixed the health. That last part is the point. The run is green only when the target is running again and reports healthy. Kestra reads the host, computes the plan, waits for a human, restarts one container at a time so a failure is attributable, waits out one healthcheck window, then reads the host again and fails the execution when a target is still unhealthy. The execution history is the record of which container was restarted on which host, who approved it and whether it recovered.
On Kestra 2.0.5 OSS against an isolated Docker 27.5.1 daemon (Docker-in-Docker on its own network), with a local HTTP sink standing in for Slack. The daemon held five containers inside it: recover (labelled, healthcheck wired to a file the entrypoint recreates, made unhealthy by deleting the file so a restart fixes it), wedged (labelled, healthcheck exit 1, so it stays unhealthy after any restart), healthy (labelled, healthy, untouched), nohealth (labelled, no healthcheck) and unlabelled (unhealthy, no label). Every health status below was cross-checked with docker inspect against that daemon.
| Run | Inputs | Result |
|---|---|---|
| 1 | only healthy and nohealth present, defaults |
2 read, 0 targets, nothing_unhealthy. Nothing restarted |
| 2 | all five present, defaults | 4 labelled read, 2 targets (recover, wedged). healthy kept as KEEP_HEALTHY, nohealth as KEEP_NO_HEALTHCHECK, unlabelled never returned by the query. Nothing restarted |
| 3 | run 2 plus auto_remediate: true |
Same plan, nothing restarted. The dry run blocks the write even with auto_remediate on |
| 4 | auto_remediate: true, dry_run: false, pause resumed approved: false |
2 targets, nothing restarted. docker inspect after: both still unhealthy, start time unchanged |
| 5 | auto_remediate: true, dry_run: false, protected_name_pattern set to wedged, pause approved |
1 target (recover), restarted, healthy after the settle. docker inspect: recover unhealthy to healthy, start time moved. wedged kept by the protect-list, untouched |
| 6 | auto_remediate: true, dry_run: false, target wedged, pause approved |
wedged restarted, still unhealthy after the settle, so verify failed the run and errors posted to Slack. docker inspect: start time moved, health still unhealthy |
| 7 | unreachable daemon | errors alert sent |
HEALTHCHECK on the containers you want managed, so the daemon has a health status to report. A container with no healthcheck is read and kept, never restarted.--label kestra.health=managed to your docker run or to the service in your Compose file, then point label_selector at it.docker:27-cli container must be able to reach docker_host. Leave docker_cli_network as bridge for a daemon that resolves by DNS. Point it at the user-defined network when the daemon is itself a container.docker run -d --privileged --name dind -e DOCKER_TLS_CERTDIR= docker:27-dind --host=tcp://0.0.0.0:2375, start a labelled container inside it with a healthcheck wired to fail, then set docker_host to tcp://dind:2375.SLACK_WEBHOOK_URL: used by findings_alert and the errors block. In Kestra OSS, provide it as the base64-encoded environment variable SECRET_SLACK_WEBHOOK_URL.| Input | Default | Purpose |
|---|---|---|
docker_host |
tcp://docker-host:2375 |
Daemon to watch |
docker_cli_network |
bridge |
Network the docker CLI container joins |
label_selector |
kestra.health=managed |
The only containers read |
protected_name_pattern |
^(db|database|state|broker|queue|cache)([-_.].*)?$ |
Names never restarted |
restart_stop_timeout_seconds |
10 |
Grace before kill on restart |
settle_seconds |
45 |
Wait before judging health again |
max_restarts |
25 |
Ceiling for one run |
auto_remediate |
false |
Must be true to restart anything |
dry_run |
true |
Must be false to restart anything |
SLACK_WEBHOOK_URL secret.docker run --health-cmd ... --label kestra.health=managed ....docker_host and label_selector, run it with the defaults and read the plan.settle_seconds above your healthcheck interval, so the re-check does not judge a container that is still starting.auto_remediate: true and dry_run: false, read the plan in the paused execution, then resume it with approved: true.nightly trigger once the plans look right. Change its inputs when you want it to act.