Skip to content

Commit

Permalink
check_bacula.py: Return a real response on a failed db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
bramwelt committed Sep 5, 2012
1 parent ec51eb1 commit 90806c4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions check_bacula.py
Expand Up @@ -22,7 +22,7 @@
from datetime import datetime, timedelta

from optparse import make_option
from pynagios import Plugin
from pynagios import Plugin, Response, CRITICAL

# Some day I will punch someone in the face for using this
# CamelCase in python
Expand Down Expand Up @@ -76,8 +76,7 @@ def check(self):
try:
conn = mysqldb.connect(db=opts.database, **conn_fields)
except mysqldb.Error, e:
print (e.args[0], e.args[1])
sys.exit(1)
return Response(CRITICAL, e.args[1])

cursor = conn.cursor()

Expand Down

0 comments on commit 90806c4

Please sign in to comment.