Module: check_mk
Branch: master
Commit: 8e9a09aa8f9d7cd1fecc8c7aee2bf7e6080a7d7a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8e9a09aa8f9d7c…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Sep 13 11:41:24 2013 +0200
livestatus: fixed error in staleness when nagios interval_length differed from 60
---
livestatus/src/HostSpecialDoubleColumn.cc | 4 +++-
livestatus/src/ServiceSpecialDoubleColumn.cc | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/livestatus/src/HostSpecialDoubleColumn.cc
b/livestatus/src/HostSpecialDoubleColumn.cc
index 07467a6..2426821 100644
--- a/livestatus/src/HostSpecialDoubleColumn.cc
+++ b/livestatus/src/HostSpecialDoubleColumn.cc
@@ -27,6 +27,8 @@
#include "logger.h"
#include "time.h"
+extern int interval_length;
+
double HostSpecialDoubleColumn::getValue(void *data)
{
data = shiftPointer(data);
@@ -37,7 +39,7 @@ double HostSpecialDoubleColumn::getValue(void *data)
switch (_type) {
case HSDC_STALENESS:
{
- return (time(0) - hst->last_check) / ((hst->check_interval == 0 ? 1 :
hst->check_interval) * 60);
+ return (time(0) - hst->last_check) / ((hst->check_interval == 0 ? 1 :
hst->check_interval) * interval_length);
}
}
return -1; // Never reached
diff --git a/livestatus/src/ServiceSpecialDoubleColumn.cc
b/livestatus/src/ServiceSpecialDoubleColumn.cc
index 205f7ff..952a152 100644
--- a/livestatus/src/ServiceSpecialDoubleColumn.cc
+++ b/livestatus/src/ServiceSpecialDoubleColumn.cc
@@ -27,6 +27,8 @@
#include "logger.h"
#include "time.h"
+extern int interval_length;
+
double ServiceSpecialDoubleColumn::getValue(void *data)
{
data = shiftPointer(data);
@@ -49,7 +51,7 @@ double ServiceSpecialDoubleColumn::getValue(void *data)
while (svc_member != 0) {
tmp_svc = svc_member->service_ptr;
if (!strncmp(tmp_svc->check_command_ptr->name,
"check-mk", 9)) {
- return check_result_age / ((tmp_svc->check_interval == 0 ? 1 :
tmp_svc->check_interval) * 60);
+ return check_result_age / ((tmp_svc->check_interval == 0 ? 1 :
tmp_svc->check_interval) * interval_length);
}
svc_member = svc_member->next;
}
@@ -57,7 +59,7 @@ double ServiceSpecialDoubleColumn::getValue(void *data)
}
else // Other non-cmk passive and active checks
{
- return check_result_age / ((svc->check_interval == 0 ? 1 :
svc->check_interval) * 60);
+ return check_result_age / ((svc->check_interval == 0 ? 1 :
svc->check_interval) * interval_length);
}
}
}