mzupan/nagios-plugin-mongodb — pull request #23 by organicveggie (2012-02-06 17:13:28+00:00)
Title: Fixed replication_lag check

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.

This 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.