Skip to content

Commit

Permalink
add check-consul-server-nodes-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Suzuki Kyosuke committed Nov 21, 2017
1 parent 92c7b47 commit c66d2ac
Showing 1 changed file with 28 additions and 0 deletions.
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
TEMP_FILE=/var/tmp/mackerel-agent/consul-server-nodes-changed

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

PREV_PEERS="$([[ -f $TEMP_FILE ]] && cat $TEMP_FILE)"
PEERS="$(curl -s http://$HOST:$PORT/v1/status/peers | tee $TEMP_FILE)"

if [[ $PREV_PEERS != $PEERS ]]; then
exit 1
fi

0 comments on commit c66d2ac

Please sign in to comment.