Module: check_mk
Branch: master
Commit: 32a3a4fbc968de9a603a99284e29adc35c77e31b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=32a3a4fbc968de…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 17 16:51:46 2014 +0100
#1789 FIX Fix preview of passive checks in WATO list of services
---
.werks/1789 | 10 ++++++++++
ChangeLog | 1 +
modules/automation.py | 2 ++
web/htdocs/js/wato.js | 2 ++
web/htdocs/status.css | 4 ++--
web/htdocs/wato.py | 6 +++++-
6 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/.werks/1789 b/.werks/1789
new file mode 100644
index 0000000..c939e04
--- /dev/null
+++ b/.werks/1789
@@ -0,0 +1,10 @@
+Title: Fix preview of passive checks in WATO list of services
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418831491
+
+
diff --git a/ChangeLog b/ChangeLog
index 1f8831a..9a3dfb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,6 +36,7 @@
* 1785 Upload SNMP MIBs via WATO...
* 1761 FIX: Ruleset search is now consistent for host & serviceparameters and
manual checks
* 1765 FIX: Fixed bug when generating nagvis backends while having sites with
livestatus proxy configured...
+ * 1789 FIX: Fix preview of passive checks in WATO list of services
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/modules/automation.py b/modules/automation.py
index 0940990..3eb7774 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -1270,6 +1270,8 @@ def automation_active_check(args):
if command_line:
command_line = autodetect_plugin(command_line)
return execute_check_plugin(command_line)
+ else:
+ return -1, "Passive check - cannot be executed"
else:
rules = active_checks.get(plugin)
if rules:
diff --git a/web/htdocs/js/wato.js b/web/htdocs/js/wato.js
index 23000dc..6580387 100644
--- a/web/htdocs/js/wato.js
+++ b/web/htdocs/js/wato.js
@@ -872,6 +872,8 @@ function handle_execute_active_check(oDiv, response_text)
// Response is STATUS\nOUTPUT
var parts = response_text.split("\n", 3);
var state = parts[0];
+ if (state == "-1")
+ state = "p"; // Pending
var statename = parts[1];
var output = parts[2];
oDiv.innerHTML = output;
diff --git a/web/htdocs/status.css b/web/htdocs/status.css
index 4836d29..d374f35 100644
--- a/web/htdocs/status.css
+++ b/web/htdocs/status.css
@@ -238,8 +238,8 @@ td.statex { /* zero count */
}
/* Row coloring in case of the different states */
-tr.odd0 { background-color: #eee; }
-tr.even0 { background-color: #ddd; }
+tr.odd0, tr.oddp { background-color: #eee; }
+tr.even0, tr.evenp { background-color: #ddd; }
td.odd0 { background-color: #eee; }
td.even0 { background-color: #ddd; }
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 0e9afb3..4ab56f1 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3329,7 +3329,11 @@ def ajax_execute_check():
hostname = html.var("host")
checktype = html.var("checktype")
item = html.var("item")
- status, output = check_mk_automation(site, "active-check", [ hostname,
checktype, item ])
+ try:
+ status, output = check_mk_automation(site, "active-check", [ hostname,
checktype, item ])
+ except Exception, e:
+ status = 1
+ output = str(e)
statename = nagios_short_state_names.get(status, "UNKN")
html.write("%d\n%s\n%s" % (status, statename, output))