Module: check_mk
Branch: master
Commit: 76909d199f7d138bab74c8a987ed4fa1b3a26534
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=76909d199f7d13…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Dec 2 16:34:35 2015 +0100
#2883 FIX default.php template: fixed id_string while creating default template, e.g. for
custom checks
---
.werks/2883 | 9 +++++++++
ChangeLog | 1 +
pnp-templates/default.php | 11 ++++++++++-
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/.werks/2883 b/.werks/2883
new file mode 100644
index 0000000..ffeedad
--- /dev/null
+++ b/.werks/2883
@@ -0,0 +1,9 @@
+Title: default.php template: fixed id_string while creating default template, e.g. for
custom checks
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1449070264
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 4011a4d..16a20d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -131,6 +131,7 @@
NOTE: Please refer to the migration notes!
* 2876 FIX: mk_logwatch: Avoid parsing lines that are currently being written by
application...
* 2806 FIX: oracle_rman: introduced missing WATO, allows configuration of backup age
+ * 2883 FIX: default.php template: fixed id_string while creating default template,
e.g. for custom checks
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/pnp-templates/default.php b/pnp-templates/default.php
index 9151127..fdfb160 100644
--- a/pnp-templates/default.php
+++ b/pnp-templates/default.php
@@ -35,7 +35,16 @@ foreach ($NAME as $i => $n) {
$perf_vars[] = $n;
}
sort($perf_vars);
-$id_string = $NAGIOS_CHECK_COMMAND . ":" . implode(",", $perf_vars);
+# We have to separate the check command name from the rest on
+# the right place, i.d. the first "!", to prevent errors while
+# creating the default template, e.g. for the custom check
+#
+# check-mk-custom!$USER2$/check_mssql_health_new --server $HOSTNAME$ --username=$USER6$
+# --password=$USER5$ --mode database-free --name filr --warning 20: --critical 10:
--commit
+#
+# If no "!" exists then $CHECK_COMMAND = $NAGIOS_CHECK_COMMAND
+$CHECK_COMMAND = explode("!", $NAGIOS_CHECK_COMMAND)[0];
+$id_string = $CHECK_COMMAND . ":" . implode(",", $perf_vars);
# Get current state of previously cached template data for this ID
$template_cache_path = $template_cache_dir . "/" . md5($id_string);