From: Gunnar Beutner Date: Wed, 26 Jun 2013 06:52:06 +0000 (+0200) Subject: Make sure flapping counters aren't negative. X-Git-Tag: v0.0.2~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46b3f033cfe7156228b313f34b251df900a37584;p=icinga2 Make sure flapping counters aren't negative. --- diff --git a/lib/icinga/service-flapping.cpp b/lib/icinga/service-flapping.cpp index 8ade1addd..6791ab4ba 100644 --- a/lib/icinga/service-flapping.cpp +++ b/lib/icinga/service-flapping.cpp @@ -77,6 +77,12 @@ void Service::UpdateFlappingStatus(bool stateChange) else negative += diff; + if (positive < 0) + positive = 0; + + if (negative < 0) + negative = 0; + Log(LogDebug, "icinga", "Flapping counter for '" + GetName() + "' is positive=" + Convert::ToString(positive) + ", negative=" + Convert::ToString(negative)); m_FlappingPositive = positive;