File check_rabbitmq-skip_option.patch of Package monitoring-plugins-rabbitmq

commit 07a2d793e8e69a0f617a628d30c570dfe41565e2
Author: Ruediger Oertel <ro@suse.de>
Date:   Tue Nov 26 16:59:45 2019 +0100

    add option to skip queues with length less than treshhold

diff --git a/check_rabbitmq b/check_rabbitmq
index 6de3cf3..e6903f1 100755
--- a/check_rabbitmq
+++ b/check_rabbitmq
@@ -80,7 +80,7 @@ def check_connection_count(critical=0, warning=0):
         print "CRITICAL - %s" % err
 
 
-def check_queues_count(critical=1000, warning=1000):
+def check_queues_count(critical=1000, warning=1000, skip=0):
     """
     A blanket check to make sure all queues are within count parameters.
     TODO: Possibly break this out so test can be done on individual queues.
@@ -93,7 +93,9 @@ def check_queues_count(critical=1000, warning=1000):
         for queue in results:
             if len(queue) == 2:
                 count = int(queue[1])
-                if count >= critical:
+                if count < skip:
+                    continue
+                elif count >= critical:
                     critical_q.append("%s: %s" % (queue[0], count)),
                 elif count >= warning:
                     warning_q.append("%s: %s" % (queue[0], count)),
@@ -217,12 +219,13 @@ if __name__ == "__main__":
                       type="int", help="Request Timeout, defaults to 1 second")
     parser.add_option("-c", "--cluster", dest="cluster", default="localhost",
                       type="string", help="Cluster IP/DNS name, defaults to localhost")
+    parser.add_option("-s", "--skip", dest="skip", type="int", help="skip items with less than SKIP entries")
     (options, args) = parser.parse_args()
 
     if options.action == "connection_count":
         check_connection_count(options.critical, options.warning)
     elif options.action == "queues_count":
-        check_queues_count(options.critical, options.warning)
+        check_queues_count(options.critical, options.warning, options.skip)
     elif options.action == "mem_usage":
         check_mem_usage(options.critical, options.warning)
     elif options.action == "aliveness":