Changed to dictionary based parameters and factory

settings (https://mathias-kettner.com/checkmk_devel_factorysettings.html)
This commit is contained in:
Marius Pana 2014-12-22 19:40:50 +02:00
parent 930fce2924
commit 0396167757

View File

@ -26,13 +26,15 @@
# Author: Marius Pana <mp@sphs.ro>
# EXAMPLE DATA FROM:
# EXAMPLE DATA FROM:
# fomat: emailaddress size_in_MB
#<<<exchange_user_mbx_size>>>
#marius.pana@sphs.ro 177
#mpana@sphs.ro 81
exchange_user_mbx_size_default_values = (1500, 2000)
factory_settings["exchange_user_mbx_size_default_values"] = {
"levels" : (1500, 2000),
}
def inventory_exchange_user_mbx_size(info):
inventory = []
@ -45,11 +47,11 @@ def inventory_exchange_user_mbx_size(info):
def check_exchange_user_mbx_size(item, params, info):
#unpack check params
warn, crit = params
warn, crit = params["levels"]
for line in info:
if line[0] == item:
mailboxsize = int(line[1])
perfdata = [ ( "size", mailboxsize, warn, crit ) ]
perfdata = [ ( "size", str(mailboxsize), warn, crit ) ]
if mailboxsize > crit:
return (2, "Mailbox size is %dMB" % mailboxsize, perfdata)
elif mailboxsize > warn:
@ -62,6 +64,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',
'has_perfdata': True,
'group': 'exchange_user_mbx_size',
}