Module: check_mk
Branch: master
Commit: 3e2c35b87d9854a78bbeb0fd1525a4628a289a2e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e2c35b87d9854…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Wed Dec 11 11:22:05 2013 +0100
FIX esx_vsphere_datastores: fixed error with reported capacity of 0 bytes
If the reported capacity of a datastore is 0 bytes the check did break with
a division by zero error.
---
.werks/88 | 11 +++++++++++
ChangeLog | 1 +
checks/esx_vsphere_datastores | 5 ++++-
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/.werks/88 b/.werks/88
new file mode 100644
index 0000000..0df9cc8
--- /dev/null
+++ b/.werks/88
@@ -0,0 +1,11 @@
+Title: esx_vsphere_datastores: fixed error with reported capacity of 0 bytes
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.3i8
+Date: 1386757166
+Targetversion: future
+
+If the reported capacity of a datastore is 0 bytes the check did break with
+a division by zero error.
diff --git a/ChangeLog b/ChangeLog
index 412526a..4cdedaa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
* 0305 FIX: apache_status: Fixed exception when agent reports HTML code as
apache-status data...
* 0104 FIX: mssql: Server instances with underline in name are now supported....
* 0240 FIX: Virtualmachine names with space no longer have missing piggyback data...
+ * 0088 FIX: esx_vsphere_datastores: fixed error with reported capacity of 0 bytes...
Multisite:
* 0302 FIX: Fixed highlight of choosen elements in foldertee/views snapin in
Chrome/IE
diff --git a/checks/esx_vsphere_datastores b/checks/esx_vsphere_datastores
index 62efcb5..30b2a90 100644
--- a/checks/esx_vsphere_datastores
+++ b/checks/esx_vsphere_datastores
@@ -71,7 +71,10 @@ def check_esx_vsphere_datastores(item, params, info):
uncommitted_mb = store["uncommitted"] / 1024.0 / 1024.0
used_mb = size_mb - avail_mb
overprov_mb = used_mb + uncommitted_mb
- overprov_percent = (overprov_mb / size_mb) * 100
+ if size_mb == 0:
+ overprov_percent = 0
+ else:
+ overprov_percent = (overprov_mb / size_mb) * 100
overprov_txt = ''
overprov_warn_mb = None