bugfix keepalive,sh

This commit is contained in:
Stefan Hoffmann 2016-06-02 23:21:02 +02:00
parent c3e4e87f2b
commit c321821855

View File

@ -11,24 +11,28 @@ while [ true ] ; do
if [ $iam = "troisdorf4" ]; then if [ $iam = "troisdorf4" ]; then
my_SN_IP=185.66.193.104 my_SN_IP=185.66.193.104
other_SN_IP=185.66.193.105 other_SN_IP=185.66.193.105
other_SN_DNS=5.fftdf.de
meship=10.188.0.4 meship=10.188.0.4
SN1=troisdorf4 SN1=troisdorf4
SN2=troisdorf5 SN2=troisdorf5
elif [ $iam = "troisdorf5" ]; then elif [ $iam = "troisdorf5" ]; then
my_SN_IP=185.66.193.105 my_SN_IP=185.66.193.105
other_SN_IP=185.66.193.106 other_SN_IP=185.66.193.106
other_SN_DNS=6.fftdf.de
meship=10.188.32.5 meship=10.188.32.5
SN1=troisdorf5 SN1=troisdorf5
SN2=troisdorf6 SN2=troisdorf6
elif [ $iam = "troisdorf6" ]; then elif [ $iam = "troisdorf6" ]; then
my_SN_IP=185.66.193.106 my_SN_IP=185.66.193.106
other_SN_IP=185.66.193.107 other_SN_IP=185.66.193.104
other_SN_DNS=4.fftdf.de
meship=10.188.64.6 meship=10.188.64.6
SN1=troisdorf6 SN1=troisdorf6
SN2=troisdorf7 SN2=troisdorf4
elif [ $iam = "troisdorf7" ]; then elif [ $iam = "troisdorf7" ]; then
my_SN_IP=185.66.193.107 my_SN_IP=185.66.193.107
other_SN_IP=185.66.193.104 other_SN_IP=185.66.193.104
other_SN_DNS=4.fftdf.de
meship=10.188.92.7 meship=10.188.92.7
SN1=troisdorf7 SN1=troisdorf7
SN2=troisdorf4 SN2=troisdorf4
@ -83,13 +87,13 @@ while [ true ] ; do
echo "collectd.gateways.$iam.sn-status $online `date +%s`" | nc -q 0 10.188.1.27 2003 echo "collectd.gateways.$iam.sn-status $online `date +%s`" | nc -q 0 10.188.1.27 2003
} }
#Check other Supernode #Check other Supernode
nc -zvu $other_SN_IP 53842 nc -zvu $other_SN_DNS 53842
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
if [ $online = 2 ]; then if [ $online = 2 ]; then
curl -X POST --data-urlencode 'payload={"text": "Aktiver Supernode wieder online. Ich habe mich wieder ausgeschaltet", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":white_check_mark:"}' https://hooks.slack.com/services/{{ slack_token }} curl -X POST --data-urlencode 'payload={"text": "Aktiver Supernode wieder online. Ich habe mich wieder ausgeschaltet", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":white_check_mark:"}' https://hooks.slack.com/services/{{ slack_token }}
supernode_on
fi fi
supernode_off
else else
supernode_backup supernode_backup
curl -X POST --data-urlencode 'payload={"text": "Aktiver Supernode offline. Ich habe mich eingeschaltet", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":warning:"}' https://hooks.slack.com/services/{{ slack_token }} curl -X POST --data-urlencode 'payload={"text": "Aktiver Supernode offline. Ich habe mich eingeschaltet", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":warning:"}' https://hooks.slack.com/services/{{ slack_token }}
@ -104,7 +108,7 @@ while [ true ] ; do
fi fi
if [ mode == 1 ]; then if [ mode == 1 ]; then
supernode_on supernode_on
else elif [ mode == 2 ]; then
supernode_backup supernode_backup
fi fi
else else