Skip to content

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

@jpoizat

Description

@jpoizat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions