New to Kestra?
Use blueprints to kickstart your first workflows.
Start a NiFi Process Group, verify activeThreadCount actually recovered, alert Slack if it did not, and log the result for data platform teams.
Apache NiFi's Start API call tells you the request was accepted, not that the Process Group is actually processing anything again; a group can report 200 OK on start and still sit at zero active threads if the underlying stuck component was never really fixed. This blueprint treats the restart as unconfirmed until a fresh status read proves it, instead of trusting the API response alone.
This blueprint was created by Mohit Jeswani.
probe_before (io.kestra.plugin.nifi.GetProcessGroupStatus) reads the current
queuedCount and activeThreadCount before anything runs.route_confirm (io.kestra.plugin.core.flow.If) only calls
io.kestra.plugin.nifi.StartProcessGroup when confirm_start is explicitly true;
otherwise it logs the current state and changes nothing in NiFi.probe_after (io.kestra.plugin.nifi.GetProcessGroupStatus) re-reads status right after,
regardless of which branch ran, so evaluate always has a current reading.evaluate (io.kestra.plugin.core.output.OutputValues) classifies DRY_RUN when nothing
was started, CRITICAL when the post-start probe itself failed, RECOVERY_CONFIRMED when
activeThreadCount reached min_active_threads_after_start, otherwise
RECOVERY_NOT_CONFIRMED.route_result (io.kestra.plugin.core.flow.If):DRY_RUN or RECOVERY_CONFIRMED with the current numbers.CRITICAL or RECOVERY_NOT_CONFIRMED to Slack.summary logs the final severity, closing the governance cycle.errors alerts Slack if the flow itself fails, for example an expired NiFi token.confirm_start must be explicitly set to true for anything in NiFi to
change, every other run is read-only.StartProcessGroup paired
with a verification probe, the companion half of this repo's existing NiFi backlog and
stall sentinel, which stops a group but deliberately leaves starting it back up as a
separate, explicit flow run, this one.NiFi's Start API reports whether the request was accepted, not whether the fix actually
worked; confirming that takes a second read and a human (or a flow) comparing the two.
Kestra keeps confirm_start as an explicit flow input instead of a habit of trusting the API
response, turns an unconfirmed restart into a Slack page naming the real numbers, and keeps a
full execution history of every attempt.
For local testing, the official Apache NiFi Docker image with single-user authentication:
docker run --name nifi -d -p 8443:8443 \\
-e SINGLE_USER_CREDENTIALS_USERNAME=admin \\
-e SINGLE_USER_CREDENTIALS_PASSWORD="<a-password-at-least-12-characters>" \\
apache/nifi:latest
NiFi's single-user password must be at least 12 characters or the image generates a
random one instead and logs it, check the container logs if login fails. The UI and
REST API are both served over HTTPS on port 8443 with a self-signed certificate by
default, which is why ssl_verify defaults to false here.
A Process Group already stopped (for example by this repo's backlog and stall sentinel, or
manually in the NiFi canvas) to exercise confirm_start: true against.
For real NiFi, a user with permission to view and modify the target Process Group's state.
A Slack incoming webhook URL.
NIFI_PASSWORD: password for nifi_username. In Kestra OSS, provide it as the
base64-encoded environment variable SECRET_NIFI_PASSWORD.SLACK_WEBHOOK_URL: used by alert and the errors block. In Kestra OSS, provide it as
the base64-encoded environment variable SECRET_SLACK_WEBHOOK_URL.| Input | Default | Purpose |
|---|---|---|
process_group_id |
root |
Process Group to restart and verify |
confirm_start |
false |
Must be true for start_process_group to actually run |
min_active_threads_after_start |
1 |
Minimum activeThreadCount required for RECOVERY_CONFIRMED |
{{ outputs.probe_before.queuedCount }} / .activeThreadCount: state before any action.{{ outputs.probe_after.queuedCount }} / .activeThreadCount: state immediately after.{{ outputs.evaluate.values.severity }}: DRY_RUN, RECOVERY_CONFIRMED,
RECOVERY_NOT_CONFIRMED, or CRITICAL.probe_after reads status immediately after start_process_group returns; NiFi may take
a few seconds to actually spin threads up on a group with many components, so a single
RECOVERY_NOT_CONFIRMED immediately after a real start can be spin-up latency rather than
a genuine failure. Rerun this flow a minute later before concluding the fix did not work.StartProcessGroup starts every component in the targeted Process Group; if the stuck
component itself still errors immediately after starting, activeThreadCount can still
read 0 even though the API call succeeded, which is exactly the case this gate is built to
catch.NIFI_PASSWORD and SLACK_WEBHOOK_URL
secrets.confirm_start: false and confirm log_dry_run reports the stopped
state without changing anything.confirm_start: true and confirm compliant or alert reports
RECOVERY_CONFIRMED or RECOVERY_NOT_CONFIRMED matching the real outcome.io.kestra.plugin.core.flow.Loop to
restart and verify several groups fixed in the same maintenance window.confirm_start: false to catch a group that showed
RECOVERY_CONFIRMED immediately but stalled again shortly after.