summaryrefslogtreecommitdiffstats
path: root/service/check_kaas.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
committerSuren A. Chilingaryan <csa@suren.me>2018-04-16 10:30:15 +0200
commit55783753ae8f2d857a7225b7a93c1d47039e5a90 (patch)
treee077b61b0f004141712e7d16876f9c19175ac681 /service/check_kaas.sh
downloadconky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.gz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.bz2
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.tar.xz
conky-55783753ae8f2d857a7225b7a93c1d47039e5a90.zip
OpenShift monitoring
Diffstat (limited to 'service/check_kaas.sh')
-rwxr-xr-xservice/check_kaas.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/service/check_kaas.sh b/service/check_kaas.sh
new file mode 100755
index 0000000..d6e7300
--- /dev/null
+++ b/service/check_kaas.sh
@@ -0,0 +1,37 @@
+#! /bin/bash
+
+cd "$(dirname "$0")"
+. opts.sh
+
+e_nodes=$2
+
+
+online=$(../scripts/ping.pl "$host")
+healthy=$online
+
+version=$(oc version | head -n 1 | awk '{ print $2 }')
+if [ -z "$version" ]; then
+ healthy=0
+else
+ version="OpenShift $version"
+fi
+
+etcd=$(oc get cs | grep etcd | grep "Healthy" | wc -l)
+if [ -z "$etcd" -o "$etcd" -lt 3 ]; then
+ healthy=2
+ oc get cs | grep etcd | grep "Healthy" | sed -r -e 's/\s+/ /g' | awk '{ print $1, $2 }' | sed 's/^/* /'
+fi
+
+if [ $healthy -ne 0 ]; then
+ nodes=$(oc get nodes | grep Ready | wc -l)
+ if [ $nodes -ge $e_nodes ]; then
+ nodes=" / \${color gray}$etcd etcd, $nodes nodes"
+ else
+ offline=$(oc get nodes | grep -v "STATUS" | grep -v "Ready" | wc -l)
+ nodes=" / \${color gray}$etcd etcd, $nodes ready, $offline offline"
+ healthy=2
+ oc get nodes | grep -v "STATUS" | grep -v "Ready" | awk '{ print $1, $2 }' | sed 's/^/* /'
+ fi
+fi
+
+echo "$online $healthy $version $nodes"