Skip to content

Commit

Permalink
add check-consul-leader-lost
Browse files Browse the repository at this point in the history
  • Loading branch information
Suzuki Kyosuke committed Nov 21, 2017
1 parent 7d63dbe commit 92c7b47
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions check-consul-leader-lost/check-consul-leader-lost
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

VERSION=v0.1.1

HOST=127.0.0.1
PORT=8500

while getopts h:p:v OPT; do
case $OPT in
h)
HOST=$OPTARG;;
p)
PORT=$OPTARG;;
v)
echo $VERSION;
exit 0;;
esac
done

curl -s http://$HOST:$PORT/v1/status/leader | fgrep -q '""'

STATUS=$?

if [[ $STATUS == "0" ]]; then
exit 2
elif [[ $STATUS == "1" ]]; then
exit 0
fi

0 comments on commit 92c7b47

Please sign in to comment.