MKP 0.2.2, checks for absolute values of configured mailboxes/aliases added
This commit is contained in:
parent
6dd87d171c
commit
16956e8d05
@ -56,7 +56,7 @@ def check_mailcow_domains(item, params, section):
|
|||||||
notice = f"Last modified: {modify_time}"
|
notice = f"Last modified: {modify_time}"
|
||||||
yield(Result(state=State.OK, notice=notice))
|
yield(Result(state=State.OK, notice=notice))
|
||||||
|
|
||||||
# create service for number of configured mailboxes
|
# create service for number of configured mailboxes (percent)
|
||||||
warn, crit = params["levels_mailcow_domains_mailboxes_used"]
|
warn, crit = params["levels_mailcow_domains_mailboxes_used"]
|
||||||
levels = (warn, crit)
|
levels = (warn, crit)
|
||||||
state_mailboxes = getStateUpper(levels, percent_used_mailboxes)
|
state_mailboxes = getStateUpper(levels, percent_used_mailboxes)
|
||||||
@ -64,7 +64,7 @@ def check_mailcow_domains(item, params, section):
|
|||||||
notice = f"Used mailboxes: {render.percent(percent_used_mailboxes)}, {number_of_mailboxes} of {max_number_of_mailboxes} in use"
|
notice = f"Used mailboxes: {render.percent(percent_used_mailboxes)}, {number_of_mailboxes} of {max_number_of_mailboxes} in use"
|
||||||
yield(Result(state=state_mailboxes, notice=notice))
|
yield(Result(state=state_mailboxes, notice=notice))
|
||||||
|
|
||||||
# create service for number of configured aliases
|
# create service for number of configured aliases (percent)
|
||||||
warn, crit = params["levels_mailcow_domains_aliases_used"]
|
warn, crit = params["levels_mailcow_domains_aliases_used"]
|
||||||
levels = (warn, crit)
|
levels = (warn, crit)
|
||||||
state_aliases = getStateUpper(levels, percent_used_aliases)
|
state_aliases = getStateUpper(levels, percent_used_aliases)
|
||||||
@ -80,6 +80,22 @@ def check_mailcow_domains(item, params, section):
|
|||||||
notice = f"Number of messages: {total_number_of_messages}"
|
notice = f"Number of messages: {total_number_of_messages}"
|
||||||
yield(Result(state=state_messages, notice=notice))
|
yield(Result(state=state_messages, notice=notice))
|
||||||
|
|
||||||
|
# create service for number of configured aliases (absolute)
|
||||||
|
warn, crit = params["levels_mailcow_domains_num_aliases"]
|
||||||
|
levels = (warn, crit)
|
||||||
|
state_aliases = getStateUpper(levels, number_of_aliases)
|
||||||
|
yield Metric("mailcow_domains_configured_aliases", number_of_aliases, levels=levels)
|
||||||
|
notice = f"Number of aliases: {number_of_aliases}, max {max_number_of_aliases} allowed"
|
||||||
|
yield(Result(state=state_aliases, notice=notice))
|
||||||
|
|
||||||
|
# create service for number of configured mailboxes (absolute)
|
||||||
|
warn, crit = params["levels_mailcow_domains_num_mailboxes"]
|
||||||
|
levels = (warn, crit)
|
||||||
|
state_mailboxes = getStateUpper(levels, number_of_mailboxes)
|
||||||
|
yield Metric("mailcow_domains_configured_mailboxes", number_of_mailboxes, levels=levels)
|
||||||
|
notice = f"Number of mailboxes: {number_of_mailboxes}, max {max_number_of_mailboxes} allowed"
|
||||||
|
yield(Result(state=state_mailboxes, notice=notice))
|
||||||
|
|
||||||
def parse_mailcow_domains_section(string_table):
|
def parse_mailcow_domains_section(string_table):
|
||||||
# convert the raw output of the agent section into a meaningful structure, do type conversions and so on
|
# convert the raw output of the agent section into a meaningful structure, do type conversions and so on
|
||||||
parsed_data = {}
|
parsed_data = {}
|
||||||
@ -148,6 +164,7 @@ register.check_plugin(
|
|||||||
"levels_mailcow_domains_aliases_used": (65.0, 85.0),
|
"levels_mailcow_domains_aliases_used": (65.0, 85.0),
|
||||||
"levels_mailcow_domains_num_messages": (10000, 25000),
|
"levels_mailcow_domains_num_messages": (10000, 25000),
|
||||||
"levels_mailcow_domains_num_aliases": (100, 250),
|
"levels_mailcow_domains_num_aliases": (100, 250),
|
||||||
|
"levels_mailcow_domains_num_mailboxes": (100, 250),
|
||||||
},
|
},
|
||||||
check_ruleset_name="mailcow_domains",
|
check_ruleset_name="mailcow_domains",
|
||||||
)
|
)
|
@ -46,3 +46,15 @@ metric_info["mailcow_domains_messages"] = {
|
|||||||
"unit": "count",
|
"unit": "count",
|
||||||
"color": "24/a",
|
"color": "24/a",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metric_info["mailcow_domains_configured_aliases"] = {
|
||||||
|
"title": _("Number of Configured Aliases"),
|
||||||
|
"unit": "count",
|
||||||
|
"color": "24/a",
|
||||||
|
}
|
||||||
|
|
||||||
|
metric_info["mailcow_domains_configured_mailboxes"] = {
|
||||||
|
"title": _("Number of Configured Mailboxes"),
|
||||||
|
"unit": "count",
|
||||||
|
"color": "24/b",
|
||||||
|
}
|
@ -75,7 +75,20 @@ def _parameter_spec_mailcow_domains():
|
|||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
("levels_mailcow_domains_num_aliases", Tuple(
|
("levels_mailcow_domains_num_aliases", Tuple(
|
||||||
title=_("Number of aliases"),
|
title=_("Number of configured aliases"),
|
||||||
|
elements=[
|
||||||
|
Integer(
|
||||||
|
title=_("Warning at"),
|
||||||
|
default_value=100,
|
||||||
|
),
|
||||||
|
Integer(
|
||||||
|
title=_("Critical at"),
|
||||||
|
default_value=250,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
("levels_mailcow_domains_num_mailboxes", Tuple(
|
||||||
|
title=_("Number of configured mailboxes"),
|
||||||
elements=[
|
elements=[
|
||||||
Integer(
|
Integer(
|
||||||
title=_("Warning at"),
|
title=_("Warning at"),
|
||||||
|
BIN
mkp/Mailcow-0.2.2.mkp
Executable file
BIN
mkp/Mailcow-0.2.2.mkp
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user