Merge "Log logstash watchdog."

This commit is contained in:
Jenkins 2014-03-01 01:21:23 +00:00 committed by Gerrit Code Review
commit f7aeb8c5f9

View File

@ -4,14 +4,20 @@
# Logstash disconnects from the cluster and will not rejoin under
# its own power.
date >> /var/log/logstash/watchdog.log
ES_ADDRESS=$1
echo "$ES_ADDRESS" >> /var/log/logstash/watchdog.log
JSON_OUT=$(curl -sf "http://${ES_ADDRESS}:9200/_cluster/nodes/${HOSTNAME}")
CURL_RET=$?
echo "$JSON_OUT" >> /var/log/logstash/watchdog.log
echo "$CURL_RET" >> /var/log/logstash/watchdog.log
RESULT=$(echo $JSON_OUT | jq '.nodes == {}')
echo "$RESULT" >> /var/log/logstash/watchdog.log
if [ "$CURL_RET" == "0" ] && [ "$RESULT" == "true" ] ;
then
echo "restarting" >> /var/log/logstash/watchdog.log
stop --quiet logstash-indexer
start --quiet logstash-indexer
fi