Module: check_mk
Branch: master
Commit: f7400da0bb58a4a5ecb1bd08e508442d73a2853e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f7400da0bb58a4…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Oct 10 15:04:25 2012 +0200
Check_MK service now able to output additional performance data
user_time, system_time, children_user_time, children_system_time
---
ChangeLog | 3 ++
modules/check_mk.py | 2 +
modules/check_mk_base.py | 9 +++++++-
pnp-templates/check-mk.php | 29 ++++++++++++++++++++++++++++
web/plugins/wato/check_mk_configuration.py | 10 +++++++++
5 files changed, 52 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fbf50d7..bbb2b60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -47,6 +47,9 @@
Checks & Agents:
* New check mssql_counters.locks: Monitors locking related information of
MSSQL tablespaces
+ * Check_MK service is now able to output additional performance data
+ user_time, system_time, children_user_time, children_system time
+
1.2.0p3:
Mulitisite
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 1e8b667..5b8d352 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -219,6 +219,7 @@ cluster_max_cachefile_age = 90 # secs.
simulation_mode = False
agent_simulator = False
perfdata_format = "pnp" # also possible:
"standard"
+check_mk_perfdata_with_times = False
debug_log = None
monitoring_host = None # deprecated
max_num_processes = 50
@@ -2623,6 +2624,7 @@ no_inventory_possible = None
'snmpwalks_dir', 'check_mk_basedir',
'nagios_user',
'www_group', 'cluster_max_cachefile_age',
'check_max_cachefile_age',
'simulation_mode', 'agent_simulator',
'aggregate_check_mk', 'debug_log',
+ 'check_mk_perfdata_with_times'
]:
output.write("%s = %r\n" % (var, globals()[var]))
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index fbe2f6f..2778f0e 100755
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -738,7 +738,14 @@ def do_check(hostname, ipaddress, only_check_types = None):
close_checkresult_file()
run_time = time.time() - start_time
- output += "execution time %.1f sec|execution_time=%.3f\n" % (run_time,
run_time)
+ if check_mk_perfdata_with_times:
+ times = os.times()
+ output += "execution time %.1f sec|execution_time=%.3f user_time=%.3f
"\
+ "system_time=%.3f children_user_time=%.3f
children_system_time=%.3f\n" %\
+ (run_time, run_time, times[0], times[1], times[2], times[3])
+ else:
+ output += "execution time %.1f sec|execution_time=%.3f\n" % (run_time,
run_time)
+
sys.stdout.write(output)
sys.exit(status)
diff --git a/pnp-templates/check-mk.php b/pnp-templates/check-mk.php
index 5ea7b6f..f37e76c 100644
--- a/pnp-templates/check-mk.php
+++ b/pnp-templates/check-mk.php
@@ -33,4 +33,33 @@ $def[1] .= "LINE1:extime#d020a0: ";
$def[1] .= "GPRINT:extime:LAST:\"current\: %.2lf s\" ";
$def[1] .= "GPRINT:extime:MAX:\"max(+/-)\: %.2lf s \" ";
$def[1] .= "GPRINT:extime:AVERAGE:\"avg(+/-)\: %.2lf s\" ";
+
+if (isset($RRDFILE[2])) {
+
+$opt[2] = "--vertical-label 'time (s)' -l 0 --title '$hostname:
Check_MK process times' ";
+$def[2] = "DEF:user_time=$RRDFILE[2]:$DS[1]:MAX ";
+$def[2] .= "LINE1:user_time#d020a0:\"user time\" ";
+$def[2] .= "GPRINT:user_time:LAST:\" current\: %.2lf s\" ";
+$def[2] .= "GPRINT:user_time:MAX:\"max(+/-)\: %.2lf s \" ";
+$def[2] .= "GPRINT:user_time:AVERAGE:\"avg(+/-)\: %.2lf s\" ";
+
+$def[2] .= "DEF:system_time=$RRDFILE[3]:$DS[1]:MAX ";
+$def[2] .= "LINE1:system_time#d08400:\"system time\" ";
+$def[2] .= "GPRINT:system_time:LAST:\" current\: %.2lf s\" ";
+$def[2] .= "GPRINT:system_time:MAX:\"max(+/-)\: %.2lf s \" ";
+$def[2] .= "GPRINT:system_time:AVERAGE:\"avg(+/-)\: %.2lf s\" ";
+
+$def[2] .= "DEF:children_user_time=$RRDFILE[4]:$DS[1]:MAX ";
+$def[2] .= "LINE1:children_user_time#308400:\"childr. user time \" ";
+$def[2] .= "GPRINT:children_user_time:LAST:\" current\: %.2lf s\" ";
+$def[2] .= "GPRINT:children_user_time:MAX:\"max(+/-)\: %.2lf s \" ";
+$def[2] .= "GPRINT:children_user_time:AVERAGE:\"avg(+/-)\: %.2lf s\"
";
+
+$def[2] .= "DEF:children_system_time=$RRDFILE[5]:$DS[1]:MAX ";
+$def[2] .= "LINE1:children_system_time#303400:\"childr. system time\"
";
+$def[2] .= "GPRINT:children_system_time:LAST:\"current\: %.2lf s\"
";
+$def[2] .= "GPRINT:children_system_time:MAX:\"max(+/-)\: %.2lf s \"
";
+$def[2] .= "GPRINT:children_system_time:AVERAGE:\"avg(+/-)\: %.2lf s\"
";
+}
+
?>
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index a54857d..039fb19 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -342,6 +342,16 @@ register_configvar(group,
("file", _("Create check files")) ]),
need_restart = True)
+register_configvar(group,
+ "check_mk_perfdata_with_times",
+ Checkbox(title = _("Check_MK with times performance data"),
+ label = _("Return process times within performance data"),
+ help = _("Enabling this option results in additional performance data
"
+ "for the Check_MK output, giving information regarding the
process times. "
+ "It provides the following fields: user_time, system_time,
children_user_time "
+ "and children_system_time")),
+ need_restart = True)
+
group = _("Inventory - automatic service detection")
register_configvar(group,