Module: check_mk
Branch: master
Commit: ab6c7ee4c39a6a41658546820e638af228350566
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab6c7ee4c39a6a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Mar 4 13:53:56 2015 +0100
#2055 FIX agent_vsphere, licenses check: now really configurable on / off
The licenses of the ESX systems were always checked, regardless of the configuration
option.
---
.werks/2055 | 10 ++++++++++
ChangeLog | 1 +
agents/special/agent_vsphere | 37 +++++++++++++++++++------------------
3 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/.werks/2055 b/.werks/2055
new file mode 100644
index 0000000..55cdc21
--- /dev/null
+++ b/.werks/2055
@@ -0,0 +1,10 @@
+Title: agent_vsphere, licenses check: now really configurable on / off
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1425473556
+
+The licenses of the ESX systems were always checked, regardless of the configuration
option.
diff --git a/ChangeLog b/ChangeLog
index 9f1ba8a..dcf70e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -224,6 +224,7 @@
* 2087 FIX: netapp_api_temp: Fixed exception when dealing with old discovered
checks...
* 2051 FIX: windows agent: no longer outputs stderr of local and plugin scripts...
* 2088 FIX: cisco_cpu: Dealing with non CPU utilization information correctly...
+ * 2055 FIX: agent_vsphere, licenses check: now really configurable on / off...
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 e64884c..503daeb 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -699,24 +699,25 @@ if not error:
###########################
# Licenses
###########################
- reply_code, reply_msg, reply_headers, licenses_response =
query_server(telegram_list["licenseassigned"])
- license_hosts = get_pattern('<returnval>(.*?)</returnval>',
licenses_response)
- licenses = {}
- for host in license_hosts:
- 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"]:
- licenses[name]["total"] += int(total)
- licenses[name]["used"] += int(used)
- licenses[name]["used_keys"].append(key)
-
- print "<<<esx_vsphere_licenses:sep(9)>>>"
- for license, values in licenses.items():
- print "%s\t%s %s" % (license, values["used"],
values["total"])
+ if "licenses" in query_objects:
+ reply_code, reply_msg, reply_headers, licenses_response =
query_server(telegram_list["licenseassigned"])
+ license_hosts =
get_pattern('<returnval>(.*?)</returnval>', licenses_response)
+ licenses = {}
+ for host in license_hosts:
+ 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"]:
+ licenses[name]["total"] += int(total)
+ licenses[name]["used"] += int(used)
+ licenses[name]["used_keys"].append(key)
+
+ print "<<<esx_vsphere_licenses:sep(9)>>>"
+ for license, values in licenses.items():
+ print "%s\t%s %s" % (license, values["used"],
values["total"])
#############################
# Determine available host systems