Module: check_mk
Branch: master
Commit: 6b063dba6d887431d2c271f6a285a69d40145462
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6b063dba6d8874…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 30 12:17:51 2013 +0200
esx_vsphere_datastores: Added uncommitted perfvalue, also added perfometer (thanks to
Sebastian Talmon)
---
checks/esx_vsphere_datastores | 8 +++++++
web/plugins/perfometer/check_mk.py | 45 +++++++++++++++++++++++++++++++++++-
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/checks/esx_vsphere_datastores b/checks/esx_vsphere_datastores
index 831e428..5000fb1 100644
--- a/checks/esx_vsphere_datastores
+++ b/checks/esx_vsphere_datastores
@@ -74,8 +74,12 @@ def check_esx_vsphere_datastores(item, params, info):
overprov_percent = (overprov_mb / size_mb) * 100
overprov_txt = ''
+ overprov_warn_mb = None
+ overprov_crit_mb = None
if 'provisioning_levels' in params:
warn, crit = params['provisioning_levels']
+ overprov_warn_mb = avail_mb / 100 * warn
+ overprov_crit_mb = avail_mb / 100 * crit
if overprov_percent >= crit:
state = max(state, 2)
overprov_txt = ' (!!)'
@@ -85,6 +89,10 @@ def check_esx_vsphere_datastores(item, params, info):
infotext += ", uncommitted: %.2f GB, provisioning: %.1f%%%s" % (
uncommitted_mb / 1024, overprov_percent, overprov_txt)
+ perfdata += [
+ ('uncommited', str(uncommitted_mb) + 'MB'),
+ ('overprovisioned', str(overprov_mb) + 'MB',
overprov_warn_mb, overprov_crit_mb),
+ ]
if not store["accessible"]:
state = 2
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 0f44fc0..a589c60 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -71,7 +71,50 @@ perfometers["check_mk-zfsget"] = perfometer_check_mk_df
perfometers["check_mk-hr_fs"] = perfometer_check_mk_df
perfometers["check_mk-oracle_asm_diskgroup"] = perfometer_check_mk_df
perfometers["check_mk-mysql_capacity"] = perfometer_check_mk_df
-perfometers["check_mk-esx_vsphere_datastores"] = perfometer_check_mk_df
+perfometers["check_mk-mysql_capacity"] = perfometer_check_mk_df
+perfometers["check_mk-esx_vsphere_counters.ramdisk"] = perfometer_check_mk_df
+
+def perfometer_check_mk_df_esx(row, check_command, perf_data):
+ h = '<table><tr>'
+ varname, value, unit, warn, crit, minn, maxx = perf_data[0]
+ uncommitted_mb= 0
+ if len(perf_data) > 3:
+ uncommitted_mb = perf_data[3][1]
+
+ perc_used = 100 * (float(value) / float(maxx))
+ perc_uncommitted = 100 * (float(uncommitted_mb) / float(maxx))
+ perc_free = 100 - float(perc_used) - float(perc_uncommitted)
+
+ state = row["service_state"]
+
+ # paint used and uncommitted
+ used_color, uncommitted_color = {
+ 0:("#0c6", "#5fa"),
+ 1:("#ff2", "#dd0"),
+ 2:("#f22", "#f99"),
+ 3:("#fa2", "#d80") }[state]
+
+ # used < size => show free space and uncommitted
+
+ if perc_free > 0:
+ h += perfometer_td(perc_used, used_color)
+ if perc_uncommitted > 0:
+ h += perfometer_td(perc_uncommitted, uncommitted_color)
+ h += perfometer_td(perc_free, "#fff")
+
+ # overcommitted => rescale values to show overcommitted percent
+ else:
+ perc_used2 = perc_used * 100 / (100 - perc_free)
+ perc_uncommitted2 = perc_uncommitted * 100 / (100 - perc_free)
+ perc_free2 = perc_free * 100 / (100 - perc_free)
+ h += perfometer_td(perc_used2, used_color)
+ h += perfometer_td(perc_uncommitted2+perc_free2, uncommitted_color)
+ h += perfometer_td(0 - perc_free2, "#fd6")
+
+ h += "</tr></table>"
+ return "%0.2f%% (+%0.2f%%)" % (perc_used, perc_uncommitted), h
+
+perfometers["check_mk-esx_vsphere_datastores"] = perfometer_check_mk_df_esx
def perfometer_check_mk_kernel_util(row, check_command, perf_data):