1
0
Fork 0
mirror of https://github.com/shouptech/nagios-plugin-check-rabbitmq.git synced 2026-02-03 14:49:41 +00:00

Added catch for urllib2.URLError (appears when connection is refused)

This commit is contained in:
Mike Shoup 2015-04-30 06:56:56 -06:00
parent 5e3db2f880
commit a47d071925

View file

@ -18,7 +18,7 @@ except ImportError:
# simplejson can be used with Python 2.4 # simplejson can be used with Python 2.4
import simplejson as json import simplejson as json
PLUGIN_VERSION = "0.1" PLUGIN_VERSION = "0.1.1"
class RabbitAPIChecker(object): class RabbitAPIChecker(object):
"""Performs checks against the RabbitMQ API and returns the results""" """Performs checks against the RabbitMQ API and returns the results"""
@ -215,7 +215,7 @@ def main():
except KeyError: except KeyError:
print "UNKNOWN - %s is not a valid action" % args[0] print "UNKNOWN - %s is not a valid action" % args[0]
return RabbitAPIChecker.STATE_UNKNOWN return RabbitAPIChecker.STATE_UNKNOWN
except urllib2.HTTPError, exception: except (urllib2.HTTPError, urllib2.URLError), exception:
print "CRITICAL - %s" % exception print "CRITICAL - %s" % exception
return RabbitAPIChecker.STATE_CRITICAL return RabbitAPIChecker.STATE_CRITICAL
except IndexError: except IndexError: