New to Kestra?
Use blueprints to kickstart your first workflows.
Automated Elasticsearch monitoring workflow to query _cluster/health, detect yellow/red status and unassigned shards, and alert Slack.
In Elasticsearch deployments supporting log analytics, full-text search, and observability pipelines, maintaining a green cluster state is essential for query availability and data durability. When nodes drop offline, disk high-watermarks are breached, or indices fail allocation, Elasticsearch enters yellow (missing replica shards) or red (missing primary shards) states.
Left undetected, unassigned shards cause write rejections, degraded search latency, and potential data loss if an underlying node hardware failure occurs while replicas remain unallocated.
This blueprint establishes an automated health watchdog for Elasticsearch. Executing every 10 minutes (or on-demand), it queries the native /_cluster/health API, inspects overall cluster status, monitors unassigned and relocating shard counts, and immediately delivers diagnostic cards to Slack when degradation is detected.
scheduled_cluster_audit trigger (io.kestra.plugin.core.trigger.Schedule) executes every 10 minutes or on-demand via the Kestra UI.check_cluster_health task (io.kestra.plugin.elasticsearch.Request) calls GET /_cluster/health against your target Elasticsearch endpoint with basic authentication.evaluate_cluster_status flowable task (io.kestra.plugin.core.flow.If) branches based on whether the cluster status is non-green or unassigned shards exceed max_allowed_unassigned_shards.notify_sre_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) broadcasts an alert with cluster name, active shard percentage, unassigned count, and troubleshooting guidance.log_healthy_cluster records nominal metrics in execution logs.export_health_manifest task records telemetry outputs for infrastructure uptime tracking.Monitoring Elasticsearch health usually requires complex metric daemons or heavy external monitoring agents. Kestra provides declarative, lightweight orchestration: it executes authenticated HTTP requests against native REST APIs, schedules continuous sweeps, conditionally alerts the team on Slack, and securely handles credentials.
| Name | Type | Default | Description |
|---|---|---|---|
elasticsearch_host |
STRING | http://elasticsearch:9200 |
HTTP endpoint of the target Elasticsearch cluster. |
max_allowed_unassigned_shards |
INT | 0 |
Tolerance threshold for unassigned shards before triggering an alert. |
slack_channel |
STRING | #sre-alerts |
Slack channel destination for Elasticsearch cluster alerts. |
{{ outputs.check_cluster_health.response.status }}: Overall cluster health status (green, yellow, or red).{{ outputs.check_cluster_health.response.unassigned_shards }}: Total number of primary or replica shards not currently allocated to nodes.{{ outputs.check_cluster_health.response.active_shards_percent_as_number }}: Percentage of active shards currently online.{{ outputs.export_health_manifest.value }}: Structured JSON telemetry manifest recording execution timestamp and cluster metrics.monitor cluster privileges to query /_cluster/health.ELASTICSEARCH_USER: Username of the account authorized to read cluster health.ELASTICSEARCH_PASSWORD: Password for the Elasticsearch monitoring user.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for sending alert notifications.ELASTICSEARCH_USER, ELASTICSEARCH_PASSWORD, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.number_of_replicas: 1 because replicas cannot be allocated to the same node. Set inputs.max_allowed_unassigned_shards accordingly for development environments.GET /_cluster/allocation/explain to embed root-cause explanations directly into the Slack message.