summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-10-06 04:17:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-10-06 04:17:15 +0200
commitfd952ed16761afcc231f16ae566af769ae1bf929 (patch)
tree0e2c607d039eca5cd38b0715005111caff0bbc2a
parenta46cecb394738926d5dac3c392e04825f94e5b2a (diff)
downloadconky-fd952ed16761afcc231f16ae566af769ae1bf929.tar.gz
conky-fd952ed16761afcc231f16ae566af769ae1bf929.tar.bz2
conky-fd952ed16761afcc231f16ae566af769ae1bf929.tar.xz
conky-fd952ed16761afcc231f16ae566af769ae1bf929.zip
Add monitoring of iperouter
-rw-r--r--netstat.conf1
-rw-r--r--remote/kaas.sh1
-rwxr-xr-xservice/check_router.sh76
3 files changed, 78 insertions, 0 deletions
diff --git a/netstat.conf b/netstat.conf
index 96bb9f6..8eeab7b 100644
--- a/netstat.conf
+++ b/netstat.conf
@@ -48,6 +48,7 @@ TEXT
${color yellow}Cluster ${hr}${lua set_width $template2}${lua set_timeout $template3}
${color white}KaaS ${goto 160}${lua_parse check_service_ kaas kaas.kit.edu 3}${color white}
${color white}KaaS/Gluster ${goto 160}${lua_parse check_service_ gluster kaas.kit.edu}${color white}
+${color white}KaaS/Router ${goto 160}${lua_parse check_service_ router iperouter}${color white}
${color yellow}Servers ${hr}${lua set_width $template2}${lua set_timeout $template3}
${color white}ipepdvsrv1 ${goto 160}${lua_parse check_server_status ipepdvsrv1.ipe.kit.edu}
diff --git a/remote/kaas.sh b/remote/kaas.sh
index 37d6a5a..31f6661 100644
--- a/remote/kaas.sh
+++ b/remote/kaas.sh
@@ -6,6 +6,7 @@
function check_kaas {
check "KaaS" "kaas.kit.edu" "check_service kaas <host> 3"
check "Gluster" "kaas.kit.edu" "check_service gluster <host>"
+ check "Router" "iperouter" "check_service router <host>"
}
print "KaaS Cluster\n"
diff --git a/service/check_router.sh b/service/check_router.sh
new file mode 100755
index 0000000..82391aa
--- /dev/null
+++ b/service/check_router.sh
@@ -0,0 +1,76 @@
+#! /bin/bash
+
+cd "$(dirname "$0")"
+. opts.sh
+
+
+www_checks=(
+ "https://ufo.kit.edu/dis/ tomography"
+ "http://ufo.kit.edu/ands/repos/openshift37/x86_64 origin"
+ "http://www.fossils.kit.edu coptera"
+ "http://www.katrin.kit.edu neutrino"
+ "http://katrin.kit.edu/data/astor/ wave"
+# "http://user:pass@katrin.kit.edu/adei-hiu/ Advanced"
+)
+
+
+online=$(../scripts/ping.pl "$host")
+healthy=$online
+
+# URL checks
+for c in "${www_checks[@]}"; do
+ url=$(echo $c | awk '{ print $1 }')
+ check=$(echo $c | awk '{ $1=""; print $0 }' | sed -e 's/^[[:space:]]\+//')
+
+ ret=$(curl -sSfL "$url" 2>&1)
+ if [ $? -ne 0 ]; then
+ echo "$url - $ret"
+ healthy=0
+ elif [ -n "$check" ]; then
+ echo $ret | grep -iP "$check" &>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "$url - specified keyword is not found"
+ healthy=0
+ fi
+ fi
+done
+
+# Katrin SSH forwaring
+ret=$(echo "" | nc -N katrin.kit.edu 22)
+if [ $? -ne 0 ]; then
+ echo "Error connecting katrin.kit.edu:22"
+ healthy=0
+else
+ echo $ret | grep SSH-2.0-OpenSSH_5.8 > /dev/null
+ if [ $? -ne 0 ]; then
+ echo "Unexpected SSH server listening on katrin.kit.edu:22. Banner: $ret"
+ healthy=0
+ fi
+fi
+
+# VPN check
+ssh darksoft.org ping -W 2 -c 2 192.168.31.1 &> /dev/null
+if [ $? -ne 0 ]; then
+ echo "Can't verify availability of UFO tunnel"
+ [ $healthy -eq 1 ] && healthy=2
+fi
+
+ping -W 2 -c 2 192.168.110.67 &> /dev/null
+if [ $? -ne 0 ]; then
+ echo "Can't verify availability of KATRIN tunnel"
+ [ $healthy -eq 1 ] && healthy=2
+fi
+
+uptime=$(ssh $host uptime | sed -e 's/^[[:space:]]\+//')
+up=$(echo $uptime | cut -d ' ' -f 3- | cut -d ',' -f 1 | sed -re 's/^\s*//')
+load=$(echo $uptime | cut -d ' ' -f 3- | cut -d ',' -f 4- | cut -d ':' -f 2 | cut -d ',' -f 3 | sed -re 's/^\s*//')
+
+ret=$(ssh $host rpm -qi redhat-release | grep Version)
+if [ $? -eq 0 ]; then
+ rel="RHEL $(echo "$ret" | cut -d ':' -f 2 | sed -e 's/^[[:space:]]\+//')"
+else
+ rel="Unknown"
+fi
+
+info=" \${color gray}/ $up, load $load"
+echo "$online $healthy $rel $info"