MKP 0.2.0, Domain checks added

This commit is contained in:
2023-08-26 15:02:28 +02:00
parent c0cb43d894
commit 4edb6adccd
6 changed files with 308 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
title: Mailcow: Mailboxes, Aliases and Storage used by Email Domain
agents: linux
catalog: unsorted
license: GPL
distribution: check_mk
description:
Tested with Mailcow versions 2022-07a and higher (use at your own risk with lower versions).
Tested only with fully dockerized Mailcow instances.
You have to provide at least the hostname/IP of your Mailcow server and an API key.
Got to configuration settings and create a new API key (read-only access is sufficient).
Allow API access to at least your CheckMK server IP address.
Shows several information about a Mailcow email domain, e.g. number of configured mailboxes/aliases, used space for all messages etc.
The check will raise WARN/CRIT if quota usage is above the configurable levels.
The check will raise WARN/CRIT if number of configured mailboxes is above the configurable levels.
The check will raise WARN/CRIT if number of configured aliases is above the configurable levels.
The check will raise WARN/CRIT if number of total messages is above the configurable levels.
item:
domainname
inventory:
one service is created for each domain

View File

@@ -21,4 +21,28 @@ metric_info["mc_num_global_messages"] = {
"title": _("Number of Messages"),
"unit": "count",
"color": "42/a",
}
metric_info["mailcow_domains_used_quota"] = {
"title": _("Domain Quota Used"),
"unit": "%",
"color": "24/a",
}
metric_info["mailcow_domains_mailboxes"] = {
"title": _("Domain Mailboxes Quota Used"),
"unit": "%",
"color": "44/b",
}
metric_info["mailcow_domains_aliases"] = {
"title": _("Domain Aliases Quota Used"),
"unit": "%",
"color": "44/a",
}
metric_info["mailcow_domains_messages"] = {
"title": _("Global Number of Messages"),
"unit": "count",
"color": "24/a",
}

View File

@@ -11,6 +11,17 @@ perfometer_info.append({
],
})
perfometer_info.append({
"type": "stacked",
"perfometers": [
{
"type": "linear",
"segments": ["mailcow_domains_used_quota"],
"total": 100.0,
},
],
})
#perfometer_info.append({
# "type": "stacked",
# "perfometers": [

View File

@@ -0,0 +1,102 @@
from cmk.gui.i18n import _
from cmk.gui.plugins.wato import (
CheckParameterRulespecWithItem,
rulespec_registry,
RulespecGroupCheckParametersApplications
)
from cmk.gui.valuespec import (
Dictionary,
ListChoice,
TextAscii,
Percentage,
Tuple,
Float,
Integer
)
def _item_spec_mailcow_domains():
return TextAscii(
title=_("Domain")
)
def _parameter_spec_mailcow_domains():
return Dictionary(
elements=[
("levels_mailcow_domains_quota_used", Tuple(
title=_("Mailcow domains quota usage for storage"),
elements=[
Percentage(
title=_("Warning at"),
default_value=65.0,
),
Percentage(
title=_("Critical at"),
default_value=85.0,
)
],
)),
("levels_mailcow_domains_mailboxes_used", Tuple(
title=_("Mailcow domains mailboxes usage"),
elements=[
Percentage(
title=_("Warning at"),
default_value=65.0,
),
Percentage(
title=_("Critical at"),
default_value=85.0,
)
],
)),
("levels_mailcow_domains_aliases_used", Tuple(
title=_("Mailcow domains aliases usage"),
elements=[
Percentage(
title=_("Warning at"),
default_value=65.0,
),
Percentage(
title=_("Critical at"),
default_value=85.0,
)
],
)),
("levels_mailcow_domains_num_messages", Tuple(
title=_("Number of messages"),
elements=[
Integer(
title=_("Warning at"),
default_value=10000,
),
Integer(
title=_("Critical at"),
default_value=25000,
)
],
)),
("levels_mailcow_domains_num_aliases", Tuple(
title=_("Number of aliases"),
elements=[
Integer(
title=_("Warning at"),
default_value=100,
),
Integer(
title=_("Critical at"),
default_value=250,
)
],
)),
],
)
rulespec_registry.register(
CheckParameterRulespecWithItem(
check_group_name="mailcow_domains",
group=RulespecGroupCheckParametersApplications,
match_type="dict",
item_spec=_item_spec_mailcow_domains,
parameter_valuespec=_parameter_spec_mailcow_domains,
title=lambda: _("Levels for Mailcow domains"),
)
)