From af658521b46751a20a5953bd9c7f3ef01c0a74d7 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 6 Jan 2019 01:56:17 +0100 Subject: Added more checks to kaas and adei --- service/check_adei.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'service/check_adei.sh') diff --git a/service/check_adei.sh b/service/check_adei.sh index f08ab5f..4edad93 100755 --- a/service/check_adei.sh +++ b/service/check_adei.sh @@ -72,6 +72,18 @@ size=$(query "$url/info.php?target=size&encoding=text") [[ "$size" =~ "Error:" ]] && size="" [ -n "$size" ] && msg="\${color gray}/ $((size / 1024 / 1024 / 1024)) GB" +# Check pending administrative scripts +if [ $healthy -ne 0 ]; then + scripts=$(query "$url/info.php?target=scripts") + waiting=$(echo $scripts | xmllint --format - | grep "Value" | sed -e "s/^\(.*mtime=\"\([^\"]*\)\".*\)$/\\2\\1/" | awk -v date="$(date +%s)" '{duration=date - $1} duration > 3600 { print duration }' | sort -rn) + num_waiting=$(echo $waiting | tr ' ' '\n' | wc -l) + long_waiting=$(echo $waiting | cut -d ' ' -f 1) + if [ $num_waiting -gt 0 ]; then + healthy=2 + echo "$num_waiting pending scripts, longest for $(format_time $long_waiting)" + fi +fi + # Verify offset (for selected database) if [ $healthy -ne 0 -a -n "$src" ]; then -- cgit v1.2.3