-
Notifications
You must be signed in to change notification settings - Fork 273
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
Monitoring replication_lag with authorization gives a generic error #169
Comments
I managed to trace this down to def set_read_preference(db) it tries to set the read preference however this: http://api.mongodb.org/python/current/api/pymongo/database.html#pymongo.database.Database.read_preference states that the property is now read only. |
@mvdwalle which version of PyMongo are you using? |
I am using version 3.0.3, your pull request unfortunatly does not solve the problem. In pymongo 3+ the read preference cannot be changed on the connection level any more and needs to be sent with the command: set_read_preference(con.admin) cannot be used anymore. |
Ok, I will have a look. Maybe can drop the whole function as setting read_preference/slave_okay is already done in mongo_connect() |
That would be great, I hit the same problem and thought I used the wrong python version or so ... |
Setting read preference might be needed for some checks. But you can do it on query time. I did that for this specific check: rs_status = con.admin.command("replSetGetStatus", read_preference=pymongo.ReadPreference.SECONDARY) |
for the time being i am downgrading to "pip install pymongo==2.8" |
Your problem is that the read prefernce function is trying to set a read only variable. Change it to this:
|
I am monitoring my mongodb replicaset with this plugin and encountered the following error:
CRITICAL - General MongoDB Error: can't set attribute
I am running the command as follows:
/usr/lib/nagios/plugins/check_mongodb -A replication_lag -W 5 -C 10 -M 3 -u {user} --pass={pass}
I have tested the plugin on a set without authentication and everything works fine.
The text was updated successfully, but these errors were encountered: