Pulsar Topic Activity Sentinel
Non-destructively sample a Pulsar topic on a schedule with a non-durable reader and page Slack when it goes silent, floods, or the broker is unreachable.
Detect Redis instances with no persistence, failed BGSAVE or AOF writes and stale snapshots, alert Slack, enable persistence and verify with INFO.
Redis is often used as more than a cache: session stores, rate limiters, job queues, feature flags. Then the persistence settings matter. They are easy to get wrong:
--save "";appendonly left at its default no;BGSAVE has been failing for days.Nothing complains until the instance restarts, and every key is gone.
This blueprint reads INFO persistence and the save configuration with redis-cli and checks them against the persistence you require. It alerts Slack when Redis is not persisting as required. It can also turn persistence on with CONFIG SET, force a BGSAVE, poll until it completes and read INFO again to verify.
This blueprint was created by zkasuran.
| Finding | Rule |
|---|---|
NO_PERSISTENCE |
save is empty and appendonly is off: every key is lost on restart |
AOF_REQUIRED_OFF / RDB_REQUIRED_OFF |
The required mechanism is disabled |
BGSAVE_FAILED |
rdb_last_bgsave_status is not ok, usually a full disk or a permission problem |
AOF_WRITE_FAILED |
aof_last_write_status is not ok |
STALE_SNAPSHOT |
RDB is on, but the last save is older than max_snapshot_age_minutes while keys have changed |
info and save_config (io.kestra.plugin.redis.cli.RedisCLI, read-only) run INFO persistence and CONFIG GET save. state parses them.findings checks them in one jq expression. summary logs the result every run.route (io.kestra.plugin.core.flow.If):alert posts to Slack.remediate_gate runs only when auto_remediate is true and dry_run is false.enable_aof and enable_rdb run CONFIG SET appendonly yes and CONFIG SET save "<policy>" only where needed, then bgsave takes a snapshot of what is already in memory.wait_for_save (io.kestra.plugin.core.flow.LoopUntil) polls INFO every 2 seconds until the save has finished with no unsaved change.verify_result reads INFO and save again, and fails if anything is still off.errors alerts Slack when the flow fails, for example on an unreachable host.Each RedisCLI task runs a single command. CONFIG SET lasts until the next restart: the final log reminds you to run CONFIG REWRITE or update redis.conf.
RedisCLI driving checks and changes.INFO persistence answers the question for one instance at one moment. Kestra runs it on a schedule, turns the answer into a Slack alert, gates the change, polls the background save with LoopUntil until it is really on disk, and keeps a history that shows when an instance stopped persisting.
On Kestra 2.0.5 OSS against Redis 7 containers started with and without persistence, with a local HTTP sink standing in for Slack.
| Run | Target | Result |
|---|---|---|
| 1 | 500 keys, --save "", --appendonly no |
NO_PERSISTENCE, AOF_REQUIRED_OFF, RDB_REQUIRED_OFF. Alert sent |
| 2 | same, dry run | Same findings, CONFIG GET appendonly still no |
| 3 | same, remediate | AOF and RDB enabled, BGSAVE awaited and verified. After docker restart, all 520 keys are back |
| 4 | control: no persistence, not remediated | After docker restart, 0 keys |
| 5 | started with AOF and RDB | Persisting as required, no alert |
| 6 | RDB, a write 1 minute after the last save, max_snapshot_age_minutes: 0 |
STALE_SNAPSHOT |
| 7 | unknown host | errors alert sent |
RedisCLI tasks start. CONFIG must not be renamed or disabled for remediation.docker run -d --name redis --network mynet redis:7-alpine redis-server --save "" --appendonly no.password: "{{ secret('REDIS_PASSWORD') }}" (and username) to each RedisCLI task.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 |
|---|---|---|
host / port |
localhost / 6379 |
Redis instance |
required |
RDB_AND_AOF |
RDB, AOF or both |
rdb_save_policy |
3600 1 300 100 60 10000 |
Applied when RDB is required but off |
max_snapshot_age_minutes |
120 |
Stale snapshot threshold |
auto_remediate |
false |
Allow CONFIG SET and BGSAVE |
dry_run |
true |
Must be false for a change to apply |
network |
empty | Docker network for the redis-cli containers |
The every_15_minutes trigger is shipped disabled and always runs in safe mode.
SLACK_WEBHOOK_URL secret.host, port, required plus network for Docker.auto_remediate: true and dry_run: false to enable persistence, then write the same settings to redis.conf.every_15_minutes trigger, which always runs in safe mode.CONFIG REWRITE after verify_result when your instances run with a writable config file.INFO replication, and alert when a replica is disconnected.BGSAVE for an off-host backup.