From 2831991db4b2b5f3569e5a05ecf35099b49d7c67 Mon Sep 17 00:00:00 2001 From: Christopher Schirner Date: Tue, 31 Jul 2018 10:41:14 +0200 Subject: [PATCH] Only check lag if connected refs #6505 --- lib/methods/clusterzonechecktask.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/methods/clusterzonechecktask.cpp b/lib/methods/clusterzonechecktask.cpp index b5a317f8b..04056f7c3 100644 --- a/lib/methods/clusterzonechecktask.cpp +++ b/lib/methods/clusterzonechecktask.cpp @@ -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), -- 2.40.0