From 6db35a5230578e296d9f493b28e6330e22569c8f Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Wed, 4 Sep 2019 22:06:01 +0200 Subject: Integrate also nagios-based monitoring here --- lib/adei/adei_print.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 lib/adei/adei_print.sh (limited to 'lib/adei/adei_print.sh') diff --git a/lib/adei/adei_print.sh b/lib/adei/adei_print.sh new file mode 100644 index 0000000..aca7735 --- /dev/null +++ b/lib/adei/adei_print.sh @@ -0,0 +1,25 @@ +function adei_print_status { + cmd="$1" + online="$2" + healthy="$3" + + if [[ "$cmd" =~ check_adei_ ]]; then + echo "$healthy" + else + echo "$online $healthy" + fi +} + +function format_time { + offset=$1 + if [ $offset -ge 86400 ]; then + echo "$((offset / 86400))d" + elif [ $offset -ge 3600 ]; then + echo "$((offset / 3600))h" + elif [ $offset -ge 60 ]; then + echo "$((offset / 60))m" + else + echo "${offset}s" + fi +} + -- cgit v1.2.3