Module: check_mk
Branch: master
Commit: 00860c0801e79a642a8ff1bdb0a1338da77a7953
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=00860c0801e79a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 3 13:17:58 2016 +0100
#3043 FIX agent_emcvnx: Fixed error handling in case of missing naviseccli command
---
.werks/3043 | 9 +++++++++
ChangeLog | 1 +
agents/special/agent_emcvnx | 14 ++++++++++----
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/.werks/3043 b/.werks/3043
new file mode 100644
index 0000000..2414a88
--- /dev/null
+++ b/.werks/3043
@@ -0,0 +1,9 @@
+Title: agent_emcvnx: Fixed error handling in case of missing naviseccli command
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1454501841
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 154ae82..a2ca644 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -242,6 +242,7 @@
* 3064 FIX: netscaler_health: no longer discovers non-running fans (i.e. in virtual
appliances)
* 2987 FIX: esx_vsphere_counters: Improved accuracy of all counter values...
* 3065 FIX: mem.win: renamed "Pagefile" to "Commit Charge" to
clarify what the number actually expresses...
+ * 3043 FIX: agent_emcvnx: Fixed error handling in case of missing naviseccli command
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/special/agent_emcvnx b/agents/special/agent_emcvnx
index c652be8..c44a61e 100755
--- a/agents/special/agent_emcvnx
+++ b/agents/special/agent_emcvnx
@@ -39,7 +39,7 @@
# <-mirrorview><-snapviews><-sancopy><-reserved>
<-cloneview><-metalun>
# <-migration><-ioportconfig> <-fastcache><-backendbus>
-import sys, os, getopt, re
+import sys, os, getopt, re, subprocess
import inspect, pprint # FOR DEBUGGING
@@ -175,19 +175,25 @@ else:
# check_mk section of agent output
#
-print "<<<check_mk>>>"
-cmd=basecmd + "getall -sp"
+cmd = basecmd + "getall -sp"
if opt_debug:
sys.stderr.write("executing external command: %s\n" % cmd)
cmdout = []
-for line in os.popen(cmd).readlines():
+try:
+ p = subprocess.Popen(cmd)
+except OSError:
+ sys.stderr.write("Failed to execute \"%s\". Maybe
\"naviseccli\" is missing.\n" % cmd)
+ sys.exit(1)
+
+for line in p.stdout.readlines():
line = line.strip()
cmdout.append(line)
tokens = re.split("\s+", line)
if tokens[0] == "Agent" and tokens[1] == "Rev:":
emcvnx_version = "_".join(tokens[2:])
+print "<<<check_mk>>>"
print "Version: %s" % emcvnx_version
# maybe we could fill AgentOS: by reading "Model:" line of naviseccli output