tripleo-common/healthcheck/redis
Martin Mágr f330e0fec6 Activate new healthchecks
In previous patches link to appropriate scripts were not added.
This patch adds links related to following already merged patches:
 - I31ab3f6777acddc802a321ff9a4728ebf574c0d4
 - If6e4fba9da81350046630420e5bee0ee4cbd14cc
 - I1109909189b2c14c89913e217e2eb3b520897596
 - I010e3e4cc7eca59c5c5b8739e2ce145d4dc8a3f1
 - Icbf450a797f95fb5966005295bd33975077e4aa5
 - Iabc042d2539963fdc59ec538e269c83f87c1843f
 - I5f8f687eecead27accb4401f9aa00aaca63ff6df
 - I290704c72e104e40d104d63583155d0eba7c128e
 - I3efc1996d67d270a6fc453a8cfcaf6f6eeae6218
 - Idd759abc454b17f3798900c5bab9ef68899610d7
 - I2e55b99a3971acf3df722415a50a4f8966e2cd25
 - Iebb0cdb911c65a78eeba148337028e8ef9aad4be
 - I8336d5778354fc21a3d9fb394fe8776febcc9173
 - Icae9acdd6b10b341c1b189872b7ef864d7ea0806
 - If9476b2dd485f8399d10289989ba74a2c1f58626
 - Id10f0d52b1732003533aba6b5c89a5079baba852
 - Ic0573f6dfe550dd7f5d6bc579b3b06660d4bf1fc

This patch also adds exec permission to healthchecks added
in above patches.

Change-Id: Ib82cb849540694106a869ec81694f1159967ee79
2018-03-07 10:44:59 +01:00

28 lines
838 B
Bash
Executable File

#!/bin/bash
if parse_out=$(cat "/etc/redis.conf" | egrep "^bind +.*$"); then
redis_host=$(echo -n $parse_out | awk '{print $2}')
else
redis_host=127.0.0.1
fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^port +.*$"); then
redis_port=$(echo -n $parse_out | awk '{print $2}')
else
redis_port=6379
fi
if parse_out=$(cat "/etc/redis.conf" | egrep "^requirepass +.*$"); then
redis_pass=$(echo -n $parse_out | awk '{print $2}')
result=$(printf "*2\r\n\$4\r\nAUTH\r\n\$${#redis_pass}\r\n${redis_pass}\r\n*1\r\n\$4\r\nPING\r\n" | nc $redis_host $redis_port)
else
result=$(printf "*1\r\n\$4\r\nPING\r\n" | nc $redis_host $redis_port)
fi
if echo $result | grep -q '+PONG'; then
echo "Redis server responded correctly on ${redis_host}:${redis_port}."
else
echo "Redis server does not respond correctly: ${result}"
exit 1
fi