Module: check_mk
Branch: master
Commit: acea4e576ddec86b98120d996e385af6bc275268
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=acea4e576ddec8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 14:24:54 2016 +0100
#3033 check_http: Now supporting extended perfdata parameter of the check
---
.werks/3033 | 9 +++++++++
ChangeLog | 1 +
checks/check_http | 3 +++
pnp-templates/check_mk_active-http.php | 22 ++++++++++++++++++++++
web/plugins/wato/active_checks.py | 8 ++++++++
5 files changed, 43 insertions(+)
diff --git a/.werks/3033 b/.werks/3033
new file mode 100644
index 0000000..5227f81
--- /dev/null
+++ b/.werks/3033
@@ -0,0 +1,9 @@
+Title: check_http: Now supporting extended perfdata parameter of the check
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453901070
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index dc1a5dd..5d9abbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -98,6 +98,7 @@
NOTE: Please refer to the migration notes!
* 2938 websphere_mq_channels: check outcome based on channel state is now
configurable...
* 2832 netscaler_vserver: improved check output for unknown protocols...
+ * 3033 check_http: Now supporting extended perfdata parameter of the check
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checks/check_http b/checks/check_http
index 85f882d..ba1bc0f 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -124,6 +124,9 @@ def check_http_arguments(params):
if settings['expect_regex'][2]:
args += ' --invert-regex'
+ if settings.get("extended_perfdata"):
+ args += ' --extended-perfdata'
+
if "post_data" in settings:
data, content_type = settings["post_data"]
args += ' -P %s -T %s' % \
diff --git a/pnp-templates/check_mk_active-http.php
b/pnp-templates/check_mk_active-http.php
index 6442b57..eaeacc5 100644
--- a/pnp-templates/check_mk_active-http.php
+++ b/pnp-templates/check_mk_active-http.php
@@ -51,4 +51,26 @@ $def[2] .= ""
. "GPRINT:size:AVERAGE:\"%3.0lf Bytes AVERAGE \" "
;
+for ( $idx = 3; $idx < count ( $RRDFILE ); $idx++ ) {
+ preg_match ( "/(?<=_time_)[a-z]*(?=.rrd)/", $RRDFILE[$idx], $matches );
+ if ( strtolower ( $matches[0] ) == "ssl" ) {
+ $ds_name = strtoupper ( $matches[0] ) . " Time";
+ }
+ else {
+ $ds_name = ucwords ( $matches[0] ) . " Time";
+ }
+
+ $opt[$idx] = "-X0 --vertical-label \"" . $ds_name . " (ms)\"
--title \"" . $ds_name . " (ms)\" ";
+ $def[$idx] = ""
+ . "DEF:var1=" . $RRDFILE[$idx] . ":" . $DS[$idx] . ":MAX
"
+ . "CDEF:ms=var1,1000,* "
+ . "AREA:ms#66ccff:\"" . $ds_name . " \" "
+ . "LINE1:ms#000000:\"\" "
+ . "GPRINT:ms:LAST:\"%3.3lg ms LAST \" "
+ . "GPRINT:ms:MAX:\"%3.3lg ms MAX \" "
+ . "GPRINT:ms:AVERAGE:\"%3.3lg ms AVERAGE \" "
+ ;
+}
+
+
?>
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index b8554f7..517c4bb 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -973,6 +973,14 @@ register_rule(group,
"to the checked URL and this
clickable."),
)
),
+ ("extended_perfdata", FixedValue(
+ value = True,
+ totext = _("Extended perfdata"),
+ title = _("Record additional performance
data"),
+ help = _("This option makes the HTTP check produce
more detailed performance data values "
+ "like the connect time, header time, time
till first byte received and the "
+ "transfer time."),
+ )),
]
),