nagios-plugin-mongodb icon indicating copy to clipboard operation
nagios-plugin-mongodb copied to clipboard

Replication_lag check returns inconsistent perfdata

Open merlyel opened this issue 7 years ago • 0 comments

If there's replica with slave delay, then warn/crit are checked against slavedelay+warn or slavedelay+crit. return(check_levels(lag, warning + slaveDelays[host_node['name']], critical + slaveDelays[host_node['name']], message)) That makes sense as we don't need to change warn/crit level for every replica we add no matter what slaveDelay is configured

But perfdata shows warn/crit without slaveDelay, making perfdata absolutely useless for graphing.

For example, slaveDelay is 3600, warn 200 and crit 4000 OK - Lag is 3602.0 seconds |replication_lag=3602.0;200.0;400.0 Everything is ok, because 3600 is less that 3800/4000 But on the graph it would look like lag is way over warn/crit

--- check_mongodb.py   2018-01-11 14:43:55.660483343 -0500
+++ check_mongodb.py    2018-01-11 14:45:06.302581117 -0500
@@ -523,7 +525,7 @@
                 message += performance_data(perf_data, [(lag, "replication_lag_percent", warning, critical)])
             else:
                 message = "Lag is " + str(lag) + " seconds"
-                message += performance_data(perf_data, [(lag, "replication_lag", warning, critical)])
+                message += performance_data(perf_data, [(lag, "replication_lag", warning + slaveDelays[host_node['name']], critical + slaveDelays[host_node['name']])])
             return(check_levels(lag, warning + slaveDelays[host_node['name']], critical + slaveDelays[host_node['name']], message))
         else:
             #

merlyel avatar Jan 11 '18 20:01 merlyel