Module: check_mk
Branch: master
Commit: 2878f5df491c8fe16dd7667721c93a8e0534a0b3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2878f5df491c8f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Nov 21 19:50:55 2011 +0100
Performance snapin: add livechecks data
---
livestatus/src/TableStatus.cc | 15 +++++++++++++++
livestatus/src/global_counters.h | 20 +++++++++++---------
livestatus/src/livechecking.c | 3 +++
web/plugins/sidebar/shipped.py | 7 +++++--
4 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/livestatus/src/TableStatus.cc b/livestatus/src/TableStatus.cc
index b09d83d..3c6eab8 100644
--- a/livestatus/src/TableStatus.cc
+++ b/livestatus/src/TableStatus.cc
@@ -56,6 +56,8 @@ extern int num_cached_log_messages;
extern int interval_length;
extern int g_num_hosts;
extern int g_num_services;
+extern int livechecks_performed;
+extern int livecheck_overflows;
extern circular_buffer external_command_buffer;
extern int external_command_buffer_slots;
@@ -102,6 +104,17 @@ TableStatus::TableStatus()
addColumn(new GlobalCountersColumn("external_commands_rate",
"the averaged number of external commands per second",
COUNTER_COMMANDS, true));
+ addColumn(new GlobalCountersColumn("livechecks",
+ "The number of checks executed via livecheck",
COUNTER_LIVECHECKS, false));
+ addColumn(new GlobalCountersColumn("livechecks_rate",
+ "The averaged number of livechecks executes per second",
COUNTER_LIVECHECKS, true));
+
+ addColumn(new GlobalCountersColumn("livecheck_overflows",
+ "The number of times a check could not be executed "
+ "because now livecheck helper was free",
COUNTER_LIVECHECK_OVERFLOWS, false));
+ addColumn(new GlobalCountersColumn("livecheck_overflows_rate",
+ "The number of livecheck overflows per second",
COUNTER_LIVECHECK_OVERFLOWS, true));
+
// Nagios program status data
addColumn(new IntPointerColumn("nagios_pid",
"The process ID of the Nagios main process", &nagios_pid
));
@@ -164,6 +177,8 @@ TableStatus::TableStatus()
"The current number of log messages MK Livestatus keeps in
memory", &num_cached_log_messages ));
addColumn(new StringPointerColumn("livestatus_version",
"The version of the MK Livestatus module", (char *)VERSION));
+
+ // Livecheck
}
void TableStatus::answerQuery(Query *query)
diff --git a/livestatus/src/global_counters.h b/livestatus/src/global_counters.h
index 4d0a63d..fbe953a 100644
--- a/livestatus/src/global_counters.h
+++ b/livestatus/src/global_counters.h
@@ -35,15 +35,17 @@
typedef uint64_t counter_t;
-#define COUNTER_NEB_CALLBACKS 0
-#define COUNTER_REQUESTS 1
-#define COUNTER_CONNECTIONS 2
-#define COUNTER_SERVICE_CHECKS 3
-#define COUNTER_HOST_CHECKS 4
-#define COUNTER_FORKS 5
-#define COUNTER_LOG_MESSAGES 6
-#define COUNTER_COMMANDS 7
-#define NUM_COUNTERS 8
+#define COUNTER_NEB_CALLBACKS 0
+#define COUNTER_REQUESTS 1
+#define COUNTER_CONNECTIONS 2
+#define COUNTER_SERVICE_CHECKS 3
+#define COUNTER_HOST_CHECKS 4
+#define COUNTER_FORKS 5
+#define COUNTER_LOG_MESSAGES 6
+#define COUNTER_COMMANDS 7
+#define COUNTER_LIVECHECKS 8
+#define COUNTER_LIVECHECK_OVERFLOWS 9
+#define NUM_COUNTERS 10
EXTERN counter_t g_counters[NUM_COUNTERS];
EXTERN counter_t g_last_counter[NUM_COUNTERS];
diff --git a/livestatus/src/livechecking.c b/livestatus/src/livechecking.c
index f4b2d42..a51a274 100644
--- a/livestatus/src/livechecking.c
+++ b/livestatus/src/livechecking.c
@@ -29,6 +29,7 @@
#include "nagios.h"
#include "logger.h"
+#include "global_counters.h"
extern int g_debug_level;
@@ -62,6 +63,7 @@ void execute_livecheck(struct live_helper *lh, const char *host_name,
fprintf(lh->fsock, "%s\n%s\n%.3f\n%s\n",
host_name, service_description, latency, command);
fflush(lh->fsock);
+ g_counters[COUNTER_LIVECHECKS]++;
}
struct live_helper *get_free_live_helper()
@@ -151,6 +153,7 @@ int broker_service_livecheck(int event_type __attribute__
((__unused__)), void *
if (!lh) {
logger(LG_INFO, "No livecheck helper free.");
// Let the core handle this check himself
+ g_counters[COUNTER_LIVECHECK_OVERFLOWS]++;
return NEB_OK;
}
diff --git a/web/plugins/sidebar/shipped.py b/web/plugins/sidebar/shipped.py
index 04a9154..5f127b1 100644
--- a/web/plugins/sidebar/shipped.py
+++ b/web/plugins/sidebar/shipped.py
@@ -560,6 +560,7 @@ def render_performance():
data = html.live.query("GET status\nColumns: service_checks_rate
host_checks_rate "
"external_commands_rate connections_rate forks_rate
"
+ "livechecks_rate livecheck_overflows_rate "
"log_messages_rate cached_log_messages\n")
for what, col, format in \
[("Service checks", 0, "%.2f/s"),
@@ -567,8 +568,10 @@ def render_performance():
("External commands", 2, "%.2f/s"),
("Livestatus-conn.", 3, "%.2f/s"),
("Process creations", 4, "%.2f/s"),
- ("New log messages", 5, "%.2f/s"),
- ("Cached log messages", 6, "%d")]:
+ ("Livechecks", 5, "%.2f/s"),
+ ("Livecheck overflows", 6, "%.2f/s"),
+ ("New log messages", 7, "%.2f/s"),
+ ("Cached log messages", 8, "%d")]:
write_line(what + ":", format % sum([row[col] for row in data]))
if len(config.allsites()) == 1: