From a47d07192518b8f78a7a71f1c9e27c73603827ae Mon Sep 17 00:00:00 2001 From: Mike Shoup Date: Thu, 30 Apr 2015 06:56:56 -0600 Subject: [PATCH] Added catch for urllib2.URLError (appears when connection is refused) --- check_rabbitmq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_rabbitmq.py b/check_rabbitmq.py index 720aa05..e98173b 100755 --- a/check_rabbitmq.py +++ b/check_rabbitmq.py @@ -18,7 +18,7 @@ except ImportError: # simplejson can be used with Python 2.4 import simplejson as json -PLUGIN_VERSION = "0.1" +PLUGIN_VERSION = "0.1.1" class RabbitAPIChecker(object): """Performs checks against the RabbitMQ API and returns the results""" @@ -215,7 +215,7 @@ def main(): except KeyError: print "UNKNOWN - %s is not a valid action" % args[0] return RabbitAPIChecker.STATE_UNKNOWN - except urllib2.HTTPError, exception: + except (urllib2.HTTPError, urllib2.URLError), exception: print "CRITICAL - %s" % exception return RabbitAPIChecker.STATE_CRITICAL except IndexError: