Module: check_mk
Branch: master
Commit: e677982000fde05d06b331de28a2c4a5c3c8421c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e677982000fde0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 18 14:46:53 2013 +0200
Added provisioning level parameters to esx_datastores check - moved parameters for this
check to own check group
---
checkman/esx_vsphere_datastores | 5 +-
checks/esx_vsphere_datastores | 18 +++-
web/plugins/wato/check_parameters.py | 153 ++++++++++++++++++++--------------
3 files changed, 107 insertions(+), 69 deletions(-)
diff --git a/checkman/esx_vsphere_datastores b/checkman/esx_vsphere_datastores
index c734303..1a7091c 100644
--- a/checkman/esx_vsphere_datastores
+++ b/checkman/esx_vsphere_datastores
@@ -22,5 +22,8 @@ inventory:
One service per datastore will be created.
[parameters]
-params(dict): See {df} for details
+params(dict): The check uses dictionary based parameters like specified for the
+ {df} check. It extends those parameters, for example it makes use of the parameter
+ {provisioning_levels} which are a tuple of percentage thresholds which are used
+ against the current provisioning percentage value.
diff --git a/checks/esx_vsphere_datastores b/checks/esx_vsphere_datastores
index 5eabe63..ce7d537 100644
--- a/checks/esx_vsphere_datastores
+++ b/checks/esx_vsphere_datastores
@@ -66,7 +66,7 @@ def check_esx_vsphere_datastores(item, params, info):
state, infotext, perfdata = df_check_filesystem_single(
g_hostname, item, size_mb, avail_mb, params)
-
+
#VMFS Stores has no field uncommitted
if store['type'] == 'NFS':
uncommitted_mb = store.get("uncommitted", 0.0) / 1024.0 / 1024.0
@@ -74,8 +74,18 @@ def check_esx_vsphere_datastores(item, params, info):
overprov_mb = used_mb + uncommitted_mb
overprov_percent = (overprov_mb / size_mb) * 100
- infotext += ", uncommitted: %.2f GB, provisioning: %.1f%%" % (
- uncommitted_mb / 1024, overprov_percent)
+ overprov_txt = ''
+ if 'provisioning_levels' in params:
+ warn, crit = params['provisioning_levels']
+ if overprov_percent >= crit:
+ state = max(state, 2)
+ overprov_txt = ' (!!)'
+ elif overprov_percent >= warn:
+ state = max(state, 1)
+ overprov_txt = ' (!)'
+
+ infotext += ", uncommitted: %.2f GB, provisioning: %.1f%%%s" % (
+ uncommitted_mb / 1024, overprov_percent, overprov_txt)
if not store["accessible"]:
state = 2
@@ -89,7 +99,7 @@ check_info['esx_vsphere_datastores'] = {
"service_description" : "fs_%s",
"includes" : [ 'df.include' ],
"has_perfdata" : True,
- "group" : "filesystem",
+ "group" : "esx_vsphere_datastores",
"default_levels_variable" : "filesystem_default_levels",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5d6ed73..68328b3 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1110,75 +1110,76 @@ register_check_parameters(
"first"
)
+filesystem_elements = [
+ ( "levels",
+ Tuple(
+ title = _("Levels for the used space"),
+ elements = [
+ Percentage(title = _("Warning at"), unit = _("%
usage"), allow_int = True, default_value=80),
+ Percentage(title = _("Critical at"), unit = _("%
usage"), allow_int = True, default_value=90)])),
+ ( "magic",
+ Float(
+ title = _("Magic factor (automatic level adaptation for large
filesystems)"),
+ default_value = 0.8,
+ minvalue = 0.1,
+ maxvalue = 1.0)),
+ ( "magic_normsize",
+ Integer(
+ title = _("Reference size for magic factor"),
+ default_value = 20,
+ minvalue = 1,
+ label = _("GB"))),
+ ( "levels_low",
+ Tuple(
+ title = _("Minimum levels if using magic factor"),
+ help = _("The filesystem levels will never fall below these values, when
using "
+ "the magic factor and the filesystem is very small."),
+ elements = [
+ Percentage(title = _("Warning at"), label =
_("usage"), allow_int = True, default_value=50),
+ Percentage(title = _("Critical at"), label =
_("usage"), allow_int = True, default_value=60)])),
+ ( "trend_range",
+ Optional(
+ Integer(
+ title = _("Range for filesystem trend computation"),
+ default_value = 24,
+ minvalue = 1,
+ label= _("hours")),
+ title = _("Trend computation"),
+ label = _("Enable trend computation"))),
+ ( "trend_mb",
+ Tuple(
+ title = _("Levels on trends in MB per range"),
+ elements = [
+ Integer(title = _("Warning at"), label = _("MB /
range"), default_value = 100),
+ Integer(title = _("Critical at"), label = _("MB /
range"), default_value = 200)
+ ])),
+ ( "trend_perc",
+ Tuple(
+ title = _("Levels for the percentual growth"),
+ elements = [
+ Percentage(title = _("Warning at"), label = _("% /
range"), default_value = 5,),
+ Percentage(title = _("Critical at"), label = _("% /
range"), default_value = 10,),
+ ])),
+ ( "trend_timeleft",
+ Tuple(
+ title = _("Levels on the time left until the filesystem gets
full"),
+ elements = [
+ Integer(title = _("Warning at"), label = _("hours
left"), default_value = 12,),
+ Integer(title = _("Critical at"), label = _("hours
left"), default_value = 6, ),
+ ])),
+ ( "trend_perfdata",
+ Checkbox(
+ title = _("Trend performance data"),
+ label = _("Enable performance data from trends"))),
+]
+
register_check_parameters(
subgroup_storage,
"filesystem",
_("Filesystems (used space and growth)"),
Dictionary(
- elements = [
- ( "levels",
- Tuple(
- title = _("Levels for the used space"),
- elements = [
- Percentage(title = _("Warning at"), unit = _("%
usage"), allow_int = True, default_value=80),
- Percentage(title = _("Critical at"), unit = _("%
usage"), allow_int = True, default_value=90)])),
- ( "magic",
- Float(
- title = _("Magic factor (automatic level adaptation for large
filesystems)"),
- default_value = 0.8,
- minvalue = 0.1,
- maxvalue = 1.0)),
- ( "magic_normsize",
- Integer(
- title = _("Reference size for magic factor"),
- default_value = 20,
- minvalue = 1,
- label = _("GB"))),
- ( "levels_low",
- Tuple(
- title = _("Minimum levels if using magic factor"),
- help = _("The filesystem levels will never fall below these
values, when using "
- "the magic factor and the filesystem is very
small."),
- elements = [
- Percentage(title = _("Warning at"), label =
_("usage"), allow_int = True, default_value=50),
- Percentage(title = _("Critical at"), label =
_("usage"), allow_int = True, default_value=60)])),
- ( "trend_range",
- Optional(
- Integer(
- title = _("Range for filesystem trend computation"),
- default_value = 24,
- minvalue = 1,
- label= _("hours")),
- title = _("Trend computation"),
- label = _("Enable trend computation"))),
- ( "trend_mb",
- Tuple(
- title = _("Levels on trends in MB per range"),
- elements = [
- Integer(title = _("Warning at"), label = _("MB /
range"), default_value = 100),
- Integer(title = _("Critical at"), label = _("MB /
range"), default_value = 200)
- ])),
- ( "trend_perc",
- Tuple(
- title = _("Levels for the percentual growth"),
- elements = [
- Percentage(title = _("Warning at"), label = _("% /
range"), default_value = 5,),
- Percentage(title = _("Critical at"), label = _("% /
range"), default_value = 10,),
- ])),
- ( "trend_timeleft",
- Tuple(
- title = _("Levels on the time left until the filesystem gets
full"),
- elements = [
- Integer(title = _("Warning at"), label = _("hours
left"), default_value = 12,),
- Integer(title = _("Critical at"), label = _("hours
left"), default_value = 6, ),
- ])),
- ( "trend_perfdata",
- Checkbox(
- title = _("Trend performance data"),
- label = _("Enable performance data from trends"))),
-
-
- ]),
+ elements = filesystem_elements,
+ ),
TextAscii(
title = _("Mount point"),
help = _("For Linux/UNIX systems, specify the mount point, for Windows
systems "
@@ -1188,6 +1189,30 @@ register_check_parameters(
)
register_check_parameters(
+ subgroup_storage,
+ "esx_vsphere_datastores",
+ _("ESX Datastores (used space and growth)"),
+ Dictionary(
+ elements = filesystem_elements + [
+ ("provisioning_levels", Tuple(
+ title = _("Provisioning Levels"),
+ help = _("Configure thresholds for overprovisioning of
datastores."),
+ elements = [
+ Percentage(title = _("Warning at overprovisioning of")),
+ Percentage(title = _("Critical at overprovisioning of")),
+ ]
+ )),
+ ],
+ ),
+ TextAscii(
+ title = _("Datastore Name"),
+ help = _("The name of the Datastore"),
+ allow_empty = False
+ ),
+ "dict"
+)
+
+register_check_parameters(
subgroup_networking,
"bonding",
_("Status of Linux bonding interfaces"),