]> granicus.if.org Git - icinga2/commitdiff
Only check lag if connected
authorChristopher Schirner <schinken@bamberg.ccc.de>
Tue, 31 Jul 2018 08:41:14 +0000 (10:41 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 1 Aug 2018 09:02:04 +0000 (11:02 +0200)
refs #6505

lib/methods/clusterzonechecktask.cpp

index b5a317f8b69b6d737851029d3bc9dcd2c7fb2560..04056f7c30ab4a3b473cd4d9aff6f96bccac0415 100644 (file)
@@ -125,22 +125,22 @@ void ClusterZoneCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const Che
        if (connected) {
                cr->SetState(ServiceOK);
                cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag));
+
+               /* Check whether the thresholds have been resolved and compare them */
+               if (missingLagCritical.IsEmpty() && zoneLag > lagCritical) {
+                       cr->SetState(ServiceCritical);
+                       cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
+                               + " greater than critical threshold: " + Utility::FormatDuration(lagCritical));
+               } else if (missingLagWarning.IsEmpty() && zoneLag > lagWarning) {
+                       cr->SetState(ServiceWarning);
+                       cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
+                               + " greater than warning threshold: " + Utility::FormatDuration(lagWarning));
+               }
        } else {
                cr->SetState(ServiceCritical);
                cr->SetOutput("Zone '" + zoneName + "' is not connected. Log lag: " + Utility::FormatDuration(zoneLag));
        }
 
-       /* Check whether the thresholds have been resolved and compare them */
-       if (missingLagCritical.IsEmpty() && zoneLag > lagCritical) {
-               cr->SetState(ServiceCritical);
-               cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
-                       + " greater than critical threshold: " + Utility::FormatDuration(lagCritical));
-       } else if (missingLagWarning.IsEmpty() && zoneLag > lagWarning) {
-               cr->SetState(ServiceWarning);
-               cr->SetOutput("Zone '" + zoneName + "' is connected. Log lag: " + Utility::FormatDuration(zoneLag)
-                       + " greater than warning threshold: " + Utility::FormatDuration(lagWarning));
-       }
-
        cr->SetPerformanceData(new Array({
                new PerfdataValue("slave_lag", zoneLag, false, "s", lagWarning, lagCritical),
                new PerfdataValue("last_messages_sent", lastMessageSent),