Module: check_mk
Branch: master
Commit: 08367e81b68c8e87e426b6d17a1d79a9cf676cc5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08367e81b68c8e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Oct 10 12:30:07 2013 +0200
esx_vsphere_vm: fixed exception when memory info for vm is missing
---
ChangeLog | 1 +
checks/esx_vsphere_vm | 24 ++++++++++++++----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0a841b6..08806d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* FIX: netapp_volumes: better output when volume is missing
* FIX: winperf_phydisk: handle case where not performance counters are available
* FIX: check_mk_agent.linux: limit Livestatus check to 3 seconds
+ * FIX: esx_vsphere_vm: fixed exception when memory info for vm is missing
Multisite:
* FIX: add missing service icons to view "All Services with this descr..."
diff --git a/checks/esx_vsphere_vm b/checks/esx_vsphere_vm
index 7cdd45d..8813c0f 100644
--- a/checks/esx_vsphere_vm
+++ b/checks/esx_vsphere_vm
@@ -53,16 +53,20 @@ def check_esx_vsphere_vm_mem(_no_item, _no_params, info):
if powerstate != "poweredOn":
raise MKCounterWrapped("", "VM is %s, skipping this check" %
powerstate)
- #consumed host memory
- host_memory_usage =
savefloat(data["summary.quickStats.hostMemoryUsage"][0]) * 1024 * 1024
- #active guest memory
- guest_memory_usage =
savefloat(data["summary.quickStats.guestMemoryUsage"][0]) * 1024 * 1024
- #size of the balloon driver in the VM
- ballooned_memory =
savefloat(data["summary.quickStats.balloonedMemory"][0]) * 1024 * 1024
- #The portion of memory, in MB, that is granted to this VM from non-shared host
memor(musst not be set)
- shared_memory = savefloat(data["summary.quickStats.sharedMemory"][0])
* 1024 * 1024
- #The portion of memory, in MB, that is granted to this VM from host memory that is
shared between VMs.
- private_memory =
savefloat(data.get("summary.quickStats.privateMemory",[0])[0]) * 1024 * 1024
+
+ try:
+ #consumed host memory
+ host_memory_usage =
savefloat(data["summary.quickStats.hostMemoryUsage"][0]) * 1024 * 1024
+ #active guest memory
+ guest_memory_usage =
savefloat(data["summary.quickStats.guestMemoryUsage"][0]) * 1024 * 1024
+ #size of the balloon driver in the VM
+ ballooned_memory =
savefloat(data["summary.quickStats.balloonedMemory"][0]) * 1024 * 1024
+ #The portion of memory, in MB, that is granted to this VM from non-shared host
memor(musst not be set)
+ shared_memory =
savefloat(data["summary.quickStats.sharedMemory"][0]) * 1024 * 1024
+ #The portion of memory, in MB, that is granted to this VM from host memory that
is shared between VMs.
+ private_memory =
savefloat(data.get("summary.quickStats.privateMemory",[0])[0]) * 1024 * 1024
+ except:
+ raise MKCounterWrapped("", "Hostsystem did not provide memory
information (reason may be high load)")
perf = [
("host", host_memory_usage ),