]> granicus.if.org Git - icinga2/commitdiff
Make sure flapping counters aren't negative.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 26 Jun 2013 06:52:06 +0000 (08:52 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 26 Jun 2013 07:03:44 +0000 (09:03 +0200)
lib/icinga/service-flapping.cpp

index 8ade1addd4def9f3f5d091907b8f6adae1a3e729..6791ab4ba17ca5f904ebe6e5222268ade7fc2a76 100644 (file)
@@ -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;