Dzahn has submitted this change and it was merged.

Change subject: fix check_mailman_queue monitoring
......................................................................


fix check_mailman_queue monitoring

The existing mailman queue monitoring script had an issue. It was supposed
to check multiple (in and out) queues and report if any of them is over the
threshold. But with the current code it would exit as OK already if just the
first of the queues was ok. So you could have nothing in "in" and a ton in "out"
and still be OK.

This fixes that, report critical if ANY of the queues are over the threshhold.

Also, add 'virgin' as another queue to check and add some debug code.

Bug:T84150
Bug:T93783
Change-Id: Ic84378aadafacb3dcead03b9b5491da876980fc0
---
M files/icinga/check_mailman_queue
1 file changed, 28 insertions(+), 9 deletions(-)

Approvals:
  jenkins-bot: Verified
  Dzahn: Looks good to me, approved



diff --git a/files/icinga/check_mailman_queue b/files/icinga/check_mailman_queue
index 1fea688..361393f 100755
--- a/files/icinga/check_mailman_queue
+++ b/files/icinga/check_mailman_queue
@@ -3,27 +3,33 @@
 #check_mailman_queue
 #~~~~~~~
 
-#:copyright: (c) 2014 Matanya Moses
+#:copyright: (c) 2014 Matanya Moses, 2015 Daniel Zahn
 #:license: Apache License 2.0.
 
 # Usage:
-# /files/icinga/check_mailman_queue $ARG
+# /files/icinga/check_mailman_queue <queue limit>
 
 mailman_base="/var/lib/mailman/qfiles"
-FILES="$mailman_base/in $mailman_base/out"
+FILES="$mailman_base/in $mailman_base/out $mailman_base/virgin"
+
+queue_limit=$1
+critqueues=0
+debug=false
+
+if [ -z "$1" ]; then echo "usage: ./check_mailman_queue <queue limit>"; exit 
3; fi
 
 for f in $FILES
 do
     if [ -d $f ]
         then
         queue_size=$(ls $f|wc -l)
-        if [ $queue_size -gt $1 ]
+        if $debug; then echo "${f}: ${queue_size}"; fi
+
+        if [ $queue_size -gt $queue_limit ]
             then
-            echo "CRITICAL: mailman ${f} queue is above ${queue_size}"
-            exit 2
-        else
-            echo "OK: mailman ${f} queue is at ${queue_size}"
-            exit 0
+            if $debug; then echo "CRIT: ${f}: ${queue_size} > ${queue_limit}"; 
fi
+            ((critqueues++))
+            if $debug; then echo "crit queues: ${critqueues}"; fi
         fi
     else
        echo "UNKNOWN : Unable to open ${f}"
@@ -31,3 +37,16 @@
     fi
 done
 
+
+if [ $critqueues -ge 1 ]
+    then
+        echo "CRITICAL: ${critqueues} mailman queue(s) above ${queue_limit}"
+        exit 2
+    else
+        echo "OK: mailman queues are below ${queue_limit}"
+        exit 0
+fi
+
+echo "UNKNOWN: check check_mailman_queue"
+exit 3
+

-- 
To view, visit https://gerrit.wikimedia.org/r/199662
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic84378aadafacb3dcead03b9b5491da876980fc0
Gerrit-PatchSet: 4
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Dzahn <[email protected]>
Gerrit-Reviewer: Dzahn <[email protected]>
Gerrit-Reviewer: Matanya <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to