mirror of
https://github.com/ivuorinen/docker-elk.git
synced 2026-02-10 02:47:06 +00:00
Initial commit
This commit is contained in:
14
elasticsearch/scripts/docker-healthcheck
Normal file
14
elasticsearch/scripts/docker-healthcheck
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
host="$(hostname --ip-address || echo '127.0.0.1')"
|
||||
|
||||
if health="$(curl -fsSL "https://$ELASTIC_USERNAME:$ELASTIC_PASSWORD@$host:$ELASTICSEARCH_PORT/_cat/health?h=status" --insecure")"; then
|
||||
health="$(echo "$health" | sed -r 's/^[[:space:]]+|[[:space:]]+$//g')" # trim whitespace (otherwise we'll have "green ")
|
||||
if [ "$health" = 'green' ] || [ "$health" = "yellow" ]; then
|
||||
exit 0
|
||||
fi
|
||||
echo >&2 "unexpected health status: $health"
|
||||
fi
|
||||
|
||||
exit 1
|
||||
Reference in New Issue
Block a user