Module: check_mk
Branch: master
Commit: 4ce3d01fbbaf615c2e870c03974a73e65e641279
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4ce3d01fbbaf61…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Feb 2 16:02:02 2015 +0100
#1931 FIX agent_vsphere: no longer crashes when host has no license information
---
.werks/1931 | 10 ++++++++++
ChangeLog | 1 +
agents/special/agent_vsphere | 5 ++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/1931 b/.werks/1931
new file mode 100644
index 0000000..bf9f995
--- /dev/null
+++ b/.werks/1931
@@ -0,0 +1,10 @@
+Title: agent_vsphere: no longer crashes when host has no license information
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1422889303
+
+
diff --git a/ChangeLog b/ChangeLog
index f477999..aaf50a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -135,6 +135,7 @@
* 1970 FIX: lparstat_aix: Made the check compatible to different kind of lparstat
output...
* 1971 FIX: printer_input/printer_output: Discovery is using name field when
available no...
NOTE: Please refer to the migration notes!
+ * 1931 FIX: agent_vsphere: no longer crashes when host has no license information
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 505aa9d..e64884c 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -703,7 +703,10 @@ if not error:
license_hosts = get_pattern('<returnval>(.*?)</returnval>',
licenses_response)
licenses = {}
for host in license_hosts:
- key, name, total, used =
get_pattern("<licenseKey>(.*?)</licenseKey>.*?<name>(.*?)</name><total>(.*?)</total><used>(.*?)</used>",
host)[0]
+ license_info =
get_pattern("<licenseKey>(.*?)</licenseKey>.*?<name>(.*?)</name><total>(.*?)</total><used>(.*?)</used>",
host)
+ if not license_info:
+ continue
+ key, name, total, used = license_info[0]
# We merge all entries with the same name, duplicate keys are ignored since
they provide the same data
licenses.setdefault(name, {"used_keys": [], "total": 0,
"used": 0})
if key not in licenses[name]["used_keys"]: