Skip to content

Commit

Permalink
some reason version is reporting funny.. so using a try/except catch.…
Browse files Browse the repository at this point in the history
…. wanted to avoid this.. but so is life
  • Loading branch information
mzupan committed Oct 5, 2010
1 parent 6809415 commit 8e66f44
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions check_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def check_connect(host, port, warning, critical):
def check_connections(host, port, warning, critical):
try:
con = pymongo.Connection(host, port, slave_okay=True)
if float(pymongo.version) > 1.7:
try:
data = con.admin.command(pymongo.son_manipulator.SON([('serverStatus', 1), ('repl', 1)]))
else:
except:
data = con.admin.command(pymongo.son.SON([('serverStatus', 1), ('repl', 1)]))

current = float(data['connections']['current'])
Expand All @@ -132,9 +132,9 @@ def check_rep_lag(host, port, warning, critical):
try:
con = pymongo.Connection(host, port, slave_okay=True)

if float(pymongo.version) > 1.7:
try:
data = con.admin.command(pymongo.son_manipulator.SON([('serverStatus', 1), ('repl', 2)]))
else:
except:
data = con.admin.command(pymongo.son.SON([('serverStatus', 1), ('repl', 2)]))

#
Expand Down

0 comments on commit 8e66f44

Please sign in to comment.