Module: check_mk
Branch: master
Commit: 218598e26e2504d4d3297b4f12ec3b2831cb5f26
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=218598e26e2504…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 18 11:36:20 2012 +0200
FIX: fix bug in assignment of livecheck helpers
Conflicts:
ChangeLog
---
ChangeLog | 6 ++++++
livestatus/src/livechecking.c | 23 ++++++++++++-----------
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 710c8ea..9741e98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -91,6 +91,12 @@
Livestatus
* FIX: comments_with_info in service table was always empty
+
+ Livecheck
+ * FIX: fixed problem with long plugin output
+ * FIX: added /0 termination to strings
+ * FIX: changed check_type to be always active (0)
+ * FIX: fix bug in assignment of livecheck helpers
Checks & Agents:
* FIX: Linux mk_logwatch: iregex Parameter was never used
diff --git a/livestatus/src/livechecking.c b/livestatus/src/livechecking.c
index 2441613..a1e7023 100644
--- a/livestatus/src/livechecking.c
+++ b/livestatus/src/livechecking.c
@@ -168,33 +168,34 @@ struct live_helper *get_free_live_helper()
if (g_live_helpers[i].status != LH_BUSY) {
continue;
}
- if (g_live_helpers[i].status != LH_DEAD) {
- int fd = g_live_helpers[i].sock;
- FD_SET(fd, &fds);
- if (fd >= max_fd)
- max_fd = fd;
- }
+ int fd = g_live_helpers[i].sock;
+ FD_SET(fd, &fds);
+ if (fd >= max_fd)
+ max_fd = fd;
}
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 0;
int r = select(max_fd + 1, &fds, 0, 0, &tv);
+
+ // No filedescriptor readable -> all livecheck helpers are busy!
if (r == 0)
return 0;
struct live_helper *free_helper = 0;
for (i=0; i<g_num_livehelpers; i++) {
if (FD_ISSET(g_live_helpers[i].sock, &fds))
- if (g_live_helpers[i].status == LH_DEAD) {
- logger(LG_INFO, "ARGL: dead livehelper found by select()!");
- return 0;
- }
g_live_helpers[i].status = LH_READY;
- free_helper = &g_live_helpers[i];
+ free_helper = &g_live_helpers[i]; // could be a candidate
}
+
+ // use last found free helper. Do not forget to set this to BUSY!
+ // (this was a bug in previous versions)
+ free_helper->status = LH_BUSY;
return free_helper;
}
+
int broker_host_livecheck(int event_type __attribute__ ((__unused__)), void *data)
{
nebstruct_host_check_data *hstdata = (nebstruct_host_check_data *)data;