Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulling replicaset from mongo to avoid -r option #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions check_mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,14 @@ def main(argv):
ssl = options.ssl
replicaset = options.replicaset

if action == 'replica_primary' and replicaset is None:
return "replicaset must be passed in when using replica_primary check"
if action == 'replica_primary':
err_f, con_f = mongo_connect(host, port, ssl, user, passwd)
if err_f != 0:
return err_f
if not replicaset:
replicaset = con_f.admin.command("replSetGetStatus")['set']
if not replicaset:
return "replicaset must be passed in when using replica_primary check"
elif not action == 'replica_primary' and replicaset:
return "passing a replicaset while not checking replica_primary does not work"

Expand Down