From 63521a36c019dd12ebf66b6ee56c0bf70ba0d1f4 Mon Sep 17 00:00:00 2001 From: Andrew Gee Date: Mon, 4 Jul 2016 14:02:47 +0100 Subject: [PATCH] Add carryover of authentication to connect_primary check --- check_mongodb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_mongodb.py b/check_mongodb.py index 7ea6e1f..4995688 100755 --- a/check_mongodb.py +++ b/check_mongodb.py @@ -250,7 +250,7 @@ def main(argv): elif action == "chunks_balance": chunks_balance(con, database, collection, warning, critical) elif action == "connect_primary": - return check_connect_primary(con, warning, critical, perf_data) + return check_connect_primary(con, warning, critical, perf_data, user, passwd) elif action == "collection_state": return check_collection_state(con, database, collection) elif action == "row_count": @@ -1376,7 +1376,7 @@ def chunks_balance(con, database, collection, warning, critical): sys.exit(0) -def check_connect_primary(con, warning, critical, perf_data): +def check_connect_primary(con, warning, critical, perf_data, user, passwd): warning = warning or 3 critical = critical or 6 @@ -1395,7 +1395,7 @@ def check_connect_primary(con, warning, critical, perf_data): pport = int(data['primary'].split(':')[1]) start = time.time() - err, con = mongo_connect(phost, pport) + err, con = mongo_connect(phost, pport, user=user, passwd=passwd) if err != 0: return err