Module: check_mk
Branch: master
Commit: 0eca259f706f9fc1d2a4c483b58e3ac9cc7a40e3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0eca259f706f9f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 30 11:42:56 2010 +0100
Fixed error handling and stdout output in check_mk
---
modules/check_mk.py | 2 +-
web/htdocs/wato.py | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 531d388..4b3cad3 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -666,7 +666,7 @@ def snmp_scan(hostname, ipaddress):
sys.stdout.write("Scanning host %s(%s) for SNMP checks..." % (hostname,
ipaddress))
sys_descr = get_single_oid(hostname, ipaddress, ".1.3.6.1.2.1.1.1.0")
if sys_descr == None:
- print "no SNMP answer"
+ sys.stderr.write("no SNMP answer\n")
return []
found = []
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index dab6df6..f1e8a4f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -497,7 +497,11 @@ def check_mk_automation(command, args=[], indata=""):
if exitcode != 0:
raise MKGeneralException("Error running <tt>%s %s %s</tt>:
<pre>%s</pre>" %
(defaults.check_mk_automation, command, " ".join(args),
outdata))
- return eval(outdata)
+ try:
+ return eval(outdata)
+ except Exception, e:
+ raise MKGeneralException("Error running <tt>%s %s %s</tt>.
Invalid output from webservice (%s): <pre>%s</pre>" %
+ (defaults.check_mk_automation, command, " ".join(args),
e, outdata))
def read_configuration_file():
@@ -525,7 +529,7 @@ def read_configuration_file():
else:
alias = None
g_hosts[hostname] = (alias, ipaddress, tags)
-
+
def write_configuration_file():
all_hosts = []