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.
Check a Redis key's TTL, alert on no-expiry or near-expiry risk, and optionally remediate with EXPIRE.
A Redis key with no TTL at all persists forever - exactly the leak that fills an
instance's memory one forgotten session token at a time. A key with a TTL that is
about to run out is a different but related risk: whatever depends on it is about to
lose it. This blueprint reads one key's TTL, alerts on either risk (or on the key being
missing entirely), and can re-apply a safe TTL with EXPIRE - never touching the key's
actual value - behind two independent, explicit gates.
periodic_ttl_check (io.kestra.plugin.core.trigger.Schedule) runs every 15 minutes, always forcing auto_remediate: "false" and dry_run: "true" through its own inputs: override regardless of this flow's defaults. Shipped disabled so you can validate a manual run first.check_key_ttl (io.kestra.plugin.redis.string.Ttl) runs TTL on redis_key, returning -1 (no expiry), -2 (missing), or the remaining seconds.evaluate_ttl_risk (io.kestra.plugin.core.flow.If) flags risk whenever ttl < min_ttl_seconds - a single comparison that also catches both sentinel values, since -1 and -2 are always less than any positive threshold.then (at risk): check_key_exists (io.kestra.plugin.core.flow.If on ttl != -2) separates a remediable key (exists, unsafe TTL) from a missing one. For a remediable key, route_remediation (io.kestra.plugin.core.flow.Switch on auto_remediate) either considers remediation ("true", gated again by dry_run through check_dry_run) or only logs that remediation is disabled ("false"). A missing key logs that EXPIRE cannot help. alert_ttl_risk always fires to Slack regardless of which of those ran.else (healthy): log_ttl_healthy records a clean check.log_audit_complete always runs last, printing the headline numbers regardless of which branch fired.errors block alerts Slack separately if the flow itself fails - an unreachable Redis instance must not read as "no risk".EXPIRE) that only ever changes the key's TTL, never its value - no risk of clobbering session or cache data.auto_remediate, dry_run) between "risk detected" and "TTL actually changed".Ttl paired with RedisCLI for an operation the structured tasks cannot do alone.TTL and EXPIRE are one-shot Redis commands with no memory of the last check, no threshold logic, and no notification path. Kestra supplies the schedule, the risk classification as a first-class branch, two independent authorization gates before anything is changed, and an execution history that shows exactly when a key went unsafe and whether it was fixed.
io.kestra.plugin.redis.cli.RedisCLI defaults to the Docker task runner with the redis:7-alpine image; io.kestra.plugin.redis.string.Ttl connects directly over the Redis protocol, no container needed on the Worker itself for that task).redis_host:redis_port.Local testing:
docker run -d --name redis-sentinel -p 6380:6379 redis:7-alpine
docker network connect YOUR_KESTRA_NETWORK redis-sentinel (only needed if the Kestra Worker runs in a separate Docker network than this container; if you map the host port, set redis_port to 6380 or whatever host port you chose, since 6379 is avoided here only as a documentation convention, not a hard requirement).
SLACK_WEBHOOK_URL: Slack incoming webhook used by alert_ttl_risk and the errors block.check_key_ttl.url and remediate_key_ttl's host/port assume an unauthenticated local instance, matching the plugin's own documentation examples. For a password-protected instance, set url: "redis://:{{ secret('REDIS_PASSWORD') }}@{{ inputs.redis_host }}:{{ inputs.redis_port }}/0" on check_key_ttl, and add password: "{{ secret('REDIS_PASSWORD') }}" to remediate_key_ttl - never place the password in redis_host/redis_port or any other input.SECRET_, base64-encoded, and read back in flows with {{ secret('NAME') }} - for example SECRET_SLACK_WEBHOOK_URL=$(echo -n 'https://hooks.slack.com/...' | base64). This keeps credentials out of the flow YAML but, per Kestra's own documentation, offers no encryption at rest or access control beyond the host environment; use the Enterprise secrets backend for stronger guarantees.redis_host (STRING, default localhost): Redis server hostname.redis_port (INT, default 6379): Redis server port.redis_key (STRING, default session:example): the single key audited.min_ttl_seconds (INT, default 300): a TTL below this, or -1/-2, counts as at risk.remediation_ttl_seconds (INT, default 3600): TTL applied by EXPIRE when remediation runs.auto_remediate (SELECT: "false", "true"; default "false"): must be "true" for remediation to even be considered.dry_run (SELECT: "true", "false"; default "true"): must be explicitly "false", together with auto_remediate: "true", for EXPIRE to actually run.outputs.check_key_ttl.ttl / .key: the raw TTL result for every run.outputs.remediate_key_ttl.vars.command_1: redis-cli's own reply to the EXPIRE command, present only when remediation actually ran.redis-cli -p 6380 SET session:example "test".SLACK_WEBHOOK_URL secret.alert_ttl_risk fires (a key with no TTL has ttl: -1, always below min_ttl_seconds) and, with auto_remediate: "false", log_remediation_disabled logs without changing anything.auto_remediate: "true" and dry_run: "true" and confirm log_dry_run_remediation describes the EXPIRE without running it.auto_remediate: "true" and dry_run: "false" and confirm remediate_key_ttl runs, then verify with redis-cli -p 6380 TTL session:example that the TTL is now set.periodic_ttl_check once you trust the check; it always runs in the safe auto_remediate: "false" / dry_run: "true" mode regardless of what you leave the flow's own defaults set to.io.kestra.plugin.core.flow.Loop, declaring the loop's own outputs: property so each iteration's Ttl result is available after the loop closes - the current single-key design intentionally avoids that added complexity.io.kestra.plugin.redis.cli.RedisCLI with a KEYS or SCAN command to discover candidate keys by pattern instead of auditing one known key.log_key_missing) to a different Slack channel or severity than the unsafe-TTL branch, since a missing key often means something upstream never ran at all.io.kestra.plugin.redis.string.Get before remediation to log the key's current value alongside its TTL for a fuller audit trail (read-only, never fed into EXPIRE).-1 and -2 are TTL values, not error codes. Redis's own TTL command overloads a single integer field with these sentinels; a null/missing-field check would miss both. This blueprint relies on ttl < min_ttl_seconds catching all three cases (unsafe-but-positive, no-expiry, missing) in one comparison.Expire task in this plugin. Verified from source: only Ttl, Get, Set, Delete, Increment exist under redis.string. Setting a TTL without rewriting the value requires io.kestra.plugin.redis.cli.RedisCLI running a raw EXPIRE command - using Set instead would silently overwrite the key's actual content.EXPIRE on a missing key is a silent no-op, not a remediation. The check_key_exists gate exists specifically so a missing key is reported as missing, never papered over by an EXPIRE call that would appear to succeed while doing nothing.auto_remediate and dry_run are independent gates, not a single boolean. Both must be "true"/"false" respectively for EXPIRE to run; setting only one leaves the other still blocking.Switch case keys "true"/"false" are quoted strings. auto_remediate renders as the literal string "true" or "false"; unquoted true:/false: YAML map keys would parse as booleans instead and would not match.