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

CRITICAL - General MongoDB Error: can't set attribute #59

Open
jpoizat opened this issue Nov 28, 2017 · 1 comment
Open

CRITICAL - General MongoDB Error: can't set attribute #59

jpoizat opened this issue Nov 28, 2017 · 1 comment

Comments

@jpoizat
Copy link

jpoizat commented Nov 28, 2017

Guys,

came to the issue this morning...

Existing code gives an error :

/opt/sensu/embedded/bin/check-mongodb.rb --user xxx --pass "xxx" -P 27017 -A replication_lag_percent
CRITICAL - General MongoDB Error: can't set attribute 

python --version : 2.7.6
pymongo : 3.0.1

I manually updated the part of this code to fix it :
Before:

def set_read_preference(db):
    if pymongo.version >= "2.2" and pymongo.version < "2.8":
        pymongo.read_preferences.Secondary
    else:
db.read_preference = pymongo.ReadPreference.SECONDARY

After:

def set_read_preference(db):
    if pymongo.version >= "2.2":
        pymongo.read_preferences.Secondary
    else:
db.read_preference = pymongo.ReadPreference.SECONDARY

I'm not sure why this 2nd test was added but it does not seems to work consistently on all versions... I don't have the env to test various versions of pymongo... so let you guys decide how to address this one.

thanks

@boutetnico
Copy link
Contributor

3eabdf6 also broke our MongoDB monitoring checks as described by @jpoizat.

This change does not follow the upstream check_mongodb.py: https://github.com/mzupan/nagios-plugin-mongodb/blob/master/check_mongodb.py#L363 and I think should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants