switched to factory settings - dictionary based

switched to factory settings - dictionary based values for our check
params
This commit is contained in:
Marius Pana 2015-01-24 14:41:21 +02:00
parent 1d556bb813
commit eea88787a9
4 changed files with 48 additions and 13 deletions

View File

@ -4,8 +4,8 @@
# EXAMPLE DATA FROM: # EXAMPLE DATA FROM:
# format: datbase size_in_MB free_MB_available # format: datbase size_in_MB free_MB_available
#<<<exchange_db_size>>> #<<<exchange_db_size>>>
#marius.pana@sphs.ro 177 #RomaniaEXC 177
#mpana@sphs.ro 81 #ExchangeDB_Size 81
factory_settings["exchange_db_size_default_values"] = { factory_settings["exchange_db_size_default_values"] = {
"levels" : (20000, 25000), "levels" : (20000, 25000),
@ -21,8 +21,10 @@ def inventory_exchange_db_size(info):
return inventory return inventory
def check_exchange_db_size(item, params, info): def check_exchange_db_size(item, params, info):
if type(params) != dict:
params = { "levels" : params }
#unpack check params #unpack check params
warn, crit = params warn, crit = params["levels"]
for line in info: for line in info:
if line[0] == item: if line[0] == item:
dbsize = int(line[1]) dbsize = int(line[1])
@ -43,7 +45,7 @@ check_info["exchange_db_size"] = {
'check_function': check_exchange_db_size, 'check_function': check_exchange_db_size,
'inventory_function': inventory_exchange_db_size, 'inventory_function': inventory_exchange_db_size,
'service_description': '%s Database size', 'service_description': '%s Database size',
#'default_levels_variable': 'exchange_user_mbx_size_default_values', 'default_levels_variable': 'exchange_user_mbx_size_default_values',
'has_perfdata': True, 'has_perfdata': True,
'group': 'exchange_db_size', 'group': 'exchange_db_size',
} }

18
info Normal file
View File

@ -0,0 +1,18 @@
{'author': 'Marius Pana',
'description': 'Check exchange database size',
'download_url': 'https://github.com/spearheadsys/check_mk-exchange-database-size',
'files': {'agents': ['plugins/sph-exchange-database-size.ps1'],
'checkman': ['exchange_db_size'],
'checks': ['exchange_db_size'],
'doc': [],
'inventory': [],
'notifications': [],
'pnp-templates': ['check_mk-exchange_db_size.php'],
'web': ['plugins/perfometer/exchange_db_size_perfometer.py',
'plugins/wato/exchange_db_size_check_parameters.py']},
'name': 'exchange_db_size',
'num_files': 6,
'title': 'exchange_db_size',
'version': '1.1',
'version.min_required': '1.2.6b1',
'version.packaged': '1.2.6b1'}

View File

@ -6,13 +6,28 @@ register_check_parameters(
subgroup_applications, subgroup_applications,
"exchange_db_size", "exchange_db_size",
_("MS Exchange Database Size"), _("MS Exchange Database Size"),
Tuple( Dictionary(
title = _('Maximum Database Size'),
elements = [ elements = [
Integer(title = _("Warning if above"), default_value = 20000 ), ("levels", # Name of your parameters
Integer(title = _("Critical if above"), default_value = 25000 ), Tuple(
] title = "Levels for database", # Specify a title for this parameters
elements = [
Integer(
title = _("Warning if above"),
unit = _("MB"),
default_value = 20000
), ),
None, Integer(
None, title = _("Critical if above"),
unit = _("MB"),
default_value = 25000
),
]
)
),
],
optional_keys = None, # Always show this subgroup
),
TextAscii( title = "Name of database"),
"dict"
) )