New to Kestra?
Use blueprints to kickstart your first workflows.
Audit OpenSearch cluster health, detect degraded yellow or red states, and alert Slack on unassigned shard accumulation before search outages occur.
Production search and log analytics clusters running OpenSearch can degrade silently before applications experience total outages. When a node restarts, disk watermarks trip, or index shards fail to allocate, OpenSearch transitions from green to yellow (missing replica shards) or red (missing primary shards). Without proactive monitoring, engineers often only discover these issues after users report slow search queries or indexing operations fail.
This blueprint provides an automated sentinel that proactively monitors OpenSearch cluster health and shard allocation on a scheduled basis. It checks both cluster-level status and underlying shard allocation diagnostics, classifies cluster operational state, and dispatches context-aware Slack alerts.
io.kestra.plugin.core.trigger.Schedule triggers the workflow
every 15 minutes, or upon manual execution by platform engineers.probe_cluster_health (io.kestra.plugin.opensearch.Request) queries _cluster/health
with allowFailure: true to retrieve the current cluster status (green, yellow, red),
active shards count, and unassigned shards count.probe_cluster_allocation (io.kestra.plugin.opensearch.Request) queries
_cluster/allocation/explain with allowFailure: true to capture diagnostic explanations
when shard allocation issues occur.classify_health_status (io.kestra.plugin.core.debug.Return) evaluates probe outputs
using Pebble expressions, categorizing cluster state into PROBE_FAILED, CLUSTER_RED,
CLUSTER_YELLOW, or HEALTHY.route_by_health_status (io.kestra.plugin.core.flow.Switch) routes downstream actions:CLUSTER_RED: Dispatches a critical incident alert to Slack indicating missing primary shards.CLUSTER_YELLOW: Dispatches a warning alert to Slack flagging unassigned replica shards.PROBE_FAILED: Dispatches an unreachable cluster or authentication failure alert.HEALTHY: Emits an operational confirmation log with active shard counts.log_audit_summary (io.kestra.plugin.core.log.Log) records an immutable audit log entry
with execution ID, cluster status, and shard counts.errors handler catches unexpected orchestration faults and notifies Slack.Monitoring distributed search clusters with cron scripts often leads to silent monitoring failures, unmanaged credentials, and unformatted alerts that lack diagnostic context. Kestra provides native OpenSearch tasks, declarative secret management, robust conditional branching via Pebble, and built-in Slack alerting within a single maintainable, auditable workflow.
opensearchproject/opensearch:2.14.0).OPENSEARCH_USERNAME: Username for OpenSearch HTTP basic authentication (required).OPENSEARCH_PASSWORD: Password for OpenSearch HTTP basic authentication (required).SLACK_WEBHOOK: Slack Incoming Webhook URL used for dispatching alert notifications (required).OPENSEARCH_USERNAME, OPENSEARCH_PASSWORD, and SLACK_WEBHOOK in your Kestra namespace secrets.docker run -d -p 9200:9200 -e "discovery.type=single-node" -e "OPENSEARCH_INITIAL_ADMIN_PASSWORD=AdminPassword123!" opensearchproject/opensearch:2.14.0every_15_minutes schedule trigger to establish automated monitoring.io.kestra.plugin.opensearch.Request task on CLUSTER_YELLOW to POST _cluster/reroute?retry_failed=true to automatically retry stuck shards._nodes/stats/fs to detect disk space saturation before shards get blocked.