Module: check_mk
Branch: master
Commit: bc80ce8588dab35b9726fcb737d70aac81403039
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bc80ce8588dab3…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Oct 11 12:29:21 2013 +0200
livestatus: fixed incorrect staleness value for
check_mk snmp checks with custom check interval
---
ChangeLog | 4 ++++
livestatus/src/ServiceSpecialDoubleColumn.cc | 17 +++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d439fee..e2a1920 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@
* FIX: livestatus table statehist: fixed rubbish entries whenever
logfile instances got unloaded
+ Livestatus:
+ * FIX: check_mk snmp checks with a custom check interval no longer
+ have an incorrect staleness value
+
Notifications:
* mkeventd: new notification plugin for forwarding notifications
to the Event Console. See inline docu in share/check_mk/notification/mkeventd
diff --git a/livestatus/src/ServiceSpecialDoubleColumn.cc
b/livestatus/src/ServiceSpecialDoubleColumn.cc
index 952a152..62804ab 100644
--- a/livestatus/src/ServiceSpecialDoubleColumn.cc
+++ b/livestatus/src/ServiceSpecialDoubleColumn.cc
@@ -38,16 +38,17 @@ double ServiceSpecialDoubleColumn::getValue(void *data)
switch (_type) {
case SSDC_STALENESS:
{
- bool is_cmk_passive = !strncmp(svc->check_command_ptr->name,
"check_mk-", 9);
-
time_t check_result_age = time(0) - svc->last_check;
- service *tmp_svc;
+ if (svc->check_interval != 0)
+ return check_result_age / (svc->check_interval * interval_length);
- // check_mk PASSIVE CHECK: Find check-mk service and get its check interval
+ // check_mk PASSIVE CHECK without check interval uses
+ // the check interval of its check-mk service
+ bool is_cmk_passive = !strncmp(svc->check_command_ptr->name,
"check_mk-", 9);
if (is_cmk_passive) {
host *host = svc->host_ptr;
+ service *tmp_svc;
servicesmember *svc_member = host->services;
- double check_interval = 1;
while (svc_member != 0) {
tmp_svc = svc_member->service_ptr;
if (!strncmp(tmp_svc->check_command_ptr->name,
"check-mk", 9)) {
@@ -55,11 +56,11 @@ double ServiceSpecialDoubleColumn::getValue(void *data)
}
svc_member = svc_member->next;
}
- return 1; // Shouldnt happen! We always except check-mk service
+ return 1; // Shouldnt happen! We always expect a check-mk service
}
- else // Other non-cmk passive and active checks
+ else // Other non-cmk passive and active checks without check_interval
{
- return check_result_age / ((svc->check_interval == 0 ? 1 :
svc->check_interval) * interval_length);
+ return check_result_age / interval_length;
}
}
}