MKP 0.2.2, checks for absolute values of configured mailboxes/aliases added

This commit is contained in:
Ralf Mellis 2023-08-26 15:55:04 +02:00
parent 6dd87d171c
commit 16956e8d05
4 changed files with 45 additions and 3 deletions

View File

@ -56,7 +56,7 @@ def check_mailcow_domains(item, params, section):
notice = f"Last modified: {modify_time}"
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"]
levels = (warn, crit)
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"
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"]
levels = (warn, crit)
state_aliases = getStateUpper(levels, percent_used_aliases)
@ -79,6 +79,22 @@ def check_mailcow_domains(item, params, section):
yield Metric("mailcow_domains_messages", total_number_of_messages, levels=levels)
notice = f"Number of messages: {total_number_of_messages}"
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):
# convert the raw output of the agent section into a meaningful structure, do type conversions and so on
@ -148,6 +164,7 @@ register.check_plugin(
"levels_mailcow_domains_aliases_used": (65.0, 85.0),
"levels_mailcow_domains_num_messages": (10000, 25000),
"levels_mailcow_domains_num_aliases": (100, 250),
"levels_mailcow_domains_num_mailboxes": (100, 250),
},
check_ruleset_name="mailcow_domains",
)

View File

@ -45,4 +45,16 @@ metric_info["mailcow_domains_messages"] = {
"title": _("Global Number of Messages"),
"unit": "count",
"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",
}

View File

@ -75,7 +75,20 @@ def _parameter_spec_mailcow_domains():
],
)),
("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=[
Integer(
title=_("Warning at"),

BIN
mkp/Mailcow-0.2.2.mkp Executable file

Binary file not shown.