Skip to content

Commit

Permalink
Trapping all exceptions as critical errors in AMQP ping.
Browse files Browse the repository at this point in the history
  • Loading branch information
williamsjj committed Aug 12, 2011
1 parent 4470a1e commit b166ab0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/chapter-10/amqp_ping_check.py
Expand Up @@ -7,7 +7,7 @@
# Author: Jason J. W. Williams
# (C)2011
###############################################
import sys, pika, socket
import sys, pika

#(nc.0) Nagios status codes
EXIT_OK = 0
Expand All @@ -29,7 +29,7 @@
try:
conn_broker = pika.BlockingConnection(conn_params)
channel = conn_broker.channel()
except socket.timeout:
except Exception:
#/(nc.3) Connection failed, return CRITICAL status
print "CRITICAL: Could not connect to %s:%s!" % (server, port)
exit(EXIT_CRITICAL)
Expand Down

0 comments on commit b166ab0

Please sign in to comment.