added info and finalzed switch to dictionary based params

This commit is contained in:
Marius Pana 2015-01-10 11:38:55 +02:00
parent f1e209d778
commit 53d27dc532
3 changed files with 38 additions and 12 deletions

View File

@ -11,19 +11,19 @@ factory_settings["exchange_user_mbx_size_default_values"] = {
"levels" : (1500, 2000),
}
exchange_user_mbx_size_default_values = (1500, 2000)
def inventory_exchange_user_mbx_size(info):
inventory = []
for line in info:
useremail = line[0]
mailboxsize = line[1]
inventory.append((useremail, "exchange_user_mbx_size_default_values"))
inventory.append((useremail, {} ))
return inventory
def check_exchange_user_mbx_size(item, params, info):
if type(params) != dict:
params = { "levels" : params }
#unpack check params
warn, crit = params
warn, crit = params["levels"]
for line in info:
if line[0] == item:
mailboxsize = int(line[1])
@ -40,7 +40,7 @@ check_info["exchange_user_mbx_size"] = {
'check_function': check_exchange_user_mbx_size,
'inventory_function': inventory_exchange_user_mbx_size,
'service_description': '%s Mailbox size',
#'default_levels_variable': 'exchange_user_mbx_size_default_values',
'default_levels_variable': 'exchange_user_mbx_size_default_values',
'has_perfdata': True,
'group': 'exchange_user_mbx_size',
}

17
info Normal file
View File

@ -0,0 +1,17 @@
{'author': 'Marius Pana',
'description': 'Check_mk check for individual exchange mailbox sizes.',
'download_url': 'https://github.com/spearheadsys/check_mk-exch-mbox',
'files': {'agents': ['plugins/SPH-Exchange-MailboxSize.ps1'],
'checkman': ['exchange_user_mbx_size'],
'checks': ['exchange_user_mbx_size'],
'doc': [],
'inventory': [],
'notifications': [],
'pnp-templates': ['check_mk-exchange_user_mbx_size.php'],
'web': ['plugins/perfometer/exchange_mbx_size_perfometer.py',
'plugins/wato/exchange_mbx_size_check_parameters.py']},
'name': 'exchange_usr_mbox_size',
'title': 'exchange_usr_mbox_size',
'version': '1.0',
'version.min_required': '1.2.6b1',
'version.packaged': '1.2.6b1'}

View File

@ -6,13 +6,22 @@ register_check_parameters(
subgroup_applications,
"exchange_user_mbx_size",
_("MS Exchange User Mailbox Size"),
Tuple(
title = _('Maximum Mailbox Size'),
elements = [
Integer(title = _("Warning if above"), default_value = 1500 ),
Integer(title = _("Critical if above"), default_value = 2000 ),
]
Dictionary(
elements = [
("Maximum Mailbox Size",
Integer(
title = _("Warning if above"),
unit = _("MB"),
default_value = 1500
),
Integer(
title = _("Critical if above"),
unit = _("MB"),
default_value = 2000
),
),
]
),
None,
None,
"dict"
)