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

Fixed replication_lag check & slave_ok deprecation warning #24

Merged
merged 5 commits into from Feb 18, 2012

Conversation

Projects
None yet
2 participants
@organicveggie
Contributor

organicveggie commented Feb 6, 2012

The previous replication lag check does not work correctly and used data ("local.slaves") that is unsupported. According to 10gen, the local.slaves "collection is not for public use and just part of the replica set internals". Specifically, the local.slaves collection will include secondary nodes that have been removed from the replica set. In addition, it didn't make a lot of sense to only have the primary report replication problems and have the secondaries report "OK", even if they were behind in replication.

The first commit replaces the old logic with a simple use of the replSetGetStatus function in MongoDB. Primaries now always report OK, since they cannot possibly be behind in replication. Secondaries report WARNING or CRITICAL if they are more than X seconds behind the primary.

The remaining commits deal with the fact that passing the "slave_ok" parameter to pymongo.Connection() is deprecated as of 2.1 and throws a warning. Since python displays the warning on standard out, Nagios reads that and believes the request has failed. The commits add support for eliminating the "slave_ok" parameter and setting db.read_preference, but only for pymongo version 2.1 and later.

@mzupan mzupan merged commit e617008 into mzupan:master Feb 18, 2012

@mzupan

This comment has been minimized.

Show comment
Hide comment
@mzupan

mzupan Feb 18, 2012

Owner

did a manual merge

Owner

mzupan commented Feb 18, 2012

did a manual merge

@mzupan

This comment has been minimized.

Show comment
Hide comment
@mzupan

mzupan Feb 18, 2012

Owner

thanks for the PR.. feel free to add yourself to the contributors with another PR

Owner

mzupan commented Feb 18, 2012

thanks for the PR.. feel free to add yourself to the contributors with another PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment