[icinga-checkins] icinga.org: icinga2/feature/configconvert-2743: Make sure flapping counters aren't negative.

git at icinga.org git at icinga.org
Wed Jun 26 09:23:10 CEST 2013


Module: icinga2
Branch: feature/configconvert-2743
Commit: 46b3f033cfe7156228b313f34b251df900a37584
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=46b3f033cfe7156228b313f34b251df900a37584

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jun 26 08:52:06 2013 +0200

Make sure flapping counters aren't negative.

---

 lib/icinga/service-flapping.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/icinga/service-flapping.cpp b/lib/icinga/service-flapping.cpp
index 8ade1ad..6791ab4 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;





More information about the icinga-checkins mailing list