MKP 0.1.0 with section mailcow_info completed
This commit is contained in:
parent
790d5b8e48
commit
0d241f6521
17
local/share/check_mk/checkman/mailcow_info
Normal file
17
local/share/check_mk/checkman/mailcow_info
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
title: Mailcow: Various information
|
||||||
|
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 instance, e.g. number of domains/mailboxes/messages.
|
||||||
|
The check will raise WARN/CRIT if the number of domains is above the configurable levels.
|
||||||
|
The check will raise WARN/CRIT if the number of mailboxes is above the configurable levels.
|
||||||
|
The check will raise WARN/CRIT if the number of messages is above the configurable levels.
|
||||||
|
inventory:
|
||||||
|
one service is created (with several details)
|
24
local/share/check_mk/web/plugins/metrics/mailcow_metrics.py
Normal file
24
local/share/check_mk/web/plugins/metrics/mailcow_metrics.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from cmk.gui.i18n import _
|
||||||
|
from cmk.gui.plugins.metrics import (
|
||||||
|
metric_info,
|
||||||
|
graph_info,
|
||||||
|
)
|
||||||
|
|
||||||
|
metric_info["mc_num_domains"] = {
|
||||||
|
"title": _("Number of Domains"),
|
||||||
|
"unit": "count",
|
||||||
|
"color": "44/a",
|
||||||
|
}
|
||||||
|
|
||||||
|
metric_info["mc_num_mailboxes"] = {
|
||||||
|
"title": _("Number of Mailboxes"),
|
||||||
|
"unit": "count",
|
||||||
|
"color": "44/b",
|
||||||
|
}
|
||||||
|
|
||||||
|
metric_info["mc_num_global_messages"] = {
|
||||||
|
"title": _("Number of Messages"),
|
||||||
|
"unit": "count",
|
||||||
|
"color": "42/a",
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
from cmk.gui.plugins.metrics import perfometer_info
|
||||||
|
|
||||||
|
perfometer_info.append({
|
||||||
|
"type": "stacked",
|
||||||
|
"perfometers": [
|
||||||
|
{
|
||||||
|
"type": "linear",
|
||||||
|
"segments": ["mc_num_domains","mc_num_mailboxes","mc_num_global_messages"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
#perfometer_info.append({
|
||||||
|
# "type": "stacked",
|
||||||
|
# "perfometers": [
|
||||||
|
# {
|
||||||
|
# "type": "linear",
|
||||||
|
# "segments": ["mc_num_mailboxes"],
|
||||||
|
# },
|
||||||
|
# ],
|
||||||
|
#})
|
||||||
|
|
||||||
|
#perfometer_info.append({
|
||||||
|
# "type": "stacked",
|
||||||
|
# "perfometers": [
|
||||||
|
# {
|
||||||
|
# "type": "linear",
|
||||||
|
# "segments": ["mc_num_global_messages"],
|
||||||
|
# },
|
||||||
|
# ],
|
||||||
|
#})
|
70
local/share/check_mk/web/plugins/wato/mailcow_info_rules.py
Normal file
70
local/share/check_mk/web/plugins/wato/mailcow_info_rules.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
from cmk.gui.i18n import _
|
||||||
|
from cmk.gui.plugins.wato import (
|
||||||
|
CheckParameterRulespecWithoutItem,
|
||||||
|
rulespec_registry,
|
||||||
|
RulespecGroupCheckParametersApplications
|
||||||
|
)
|
||||||
|
|
||||||
|
from cmk.gui.valuespec import (
|
||||||
|
Dictionary,
|
||||||
|
ListChoice,
|
||||||
|
Tuple,
|
||||||
|
Percentage,
|
||||||
|
Integer,
|
||||||
|
Float,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _parameter_spec_mailcow_info():
|
||||||
|
return Dictionary(
|
||||||
|
elements=[
|
||||||
|
("levels_num_domains", Tuple(
|
||||||
|
title=_("Number of email domains"),
|
||||||
|
elements=[
|
||||||
|
Integer(
|
||||||
|
title=_("Warning at"),
|
||||||
|
default_value=100,
|
||||||
|
),
|
||||||
|
Integer(
|
||||||
|
title=_("Critical at"),
|
||||||
|
default_value=200,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
("levels_num_mailboxes", Tuple(
|
||||||
|
title=_("Number of mailboxes"),
|
||||||
|
elements=[
|
||||||
|
Integer(
|
||||||
|
title=_("Warning at"),
|
||||||
|
default_value=500,
|
||||||
|
),
|
||||||
|
Integer(
|
||||||
|
title=_("Critical at"),
|
||||||
|
default_value=1000,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
("levels_num_global_messages", Tuple(
|
||||||
|
title=_("Number of messages"),
|
||||||
|
elements=[
|
||||||
|
Integer(
|
||||||
|
title=_("Warning at"),
|
||||||
|
default_value=100000,
|
||||||
|
),
|
||||||
|
Integer(
|
||||||
|
title=_("Critical at"),
|
||||||
|
default_value=250000,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
rulespec_registry.register(
|
||||||
|
CheckParameterRulespecWithoutItem(
|
||||||
|
check_group_name="mailcow_info",
|
||||||
|
group=RulespecGroupCheckParametersApplications,
|
||||||
|
match_type="dict",
|
||||||
|
parameter_valuespec=_parameter_spec_mailcow_info,
|
||||||
|
title=lambda: _("Mailcow Info"),
|
||||||
|
)
|
||||||
|
)
|
50
local/share/check_mk/web/plugins/wato/mailcow_params.py
Normal file
50
local/share/check_mk/web/plugins/wato/mailcow_params.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
from cmk.gui.i18n import _
|
||||||
|
from cmk.gui.plugins.wato import (
|
||||||
|
CheckParameterRulespecWithItem,
|
||||||
|
rulespec_registry,
|
||||||
|
RulespecGroupCheckParametersOperatingSystem,
|
||||||
|
)
|
||||||
|
|
||||||
|
from cmk.gui.valuespec import (
|
||||||
|
Dictionary,
|
||||||
|
ListChoice,
|
||||||
|
Checkbox,
|
||||||
|
TextAscii,
|
||||||
|
Password,
|
||||||
|
)
|
||||||
|
|
||||||
|
from cmk.gui.plugins.wato import (
|
||||||
|
HostRulespec,
|
||||||
|
)
|
||||||
|
|
||||||
|
from cmk.gui.plugins.wato.datasource_programs import RulespecGroupDatasourceProgramsCustom
|
||||||
|
|
||||||
|
def _valuespec_special_agent_mailcow():
|
||||||
|
return Dictionary(
|
||||||
|
title=_("Mailcow Server Information"),
|
||||||
|
help = _("Checking Mailcow instances via API"),
|
||||||
|
elements=[
|
||||||
|
("hostname", TextAscii(title=_("Hostname"),
|
||||||
|
allow_empty=False,
|
||||||
|
help=_("Hostname of Mailcow server (bare FQDN or IP), mandatory"))),
|
||||||
|
("apikey", TextAscii(title=_("API Key"),
|
||||||
|
allow_empty=False,
|
||||||
|
help=_("API Key, mandatory"))),
|
||||||
|
("port", TextAscii(title=_("Port"),
|
||||||
|
allow_empty=True,
|
||||||
|
help=_("Specify port if not listening to HTTPS/HTTP, optional"))),
|
||||||
|
("no_https", Checkbox(title=_("Disable HTTPS"),
|
||||||
|
help=_("Activate to disable TLS encryption (not recommended), optional"))),
|
||||||
|
("no_cert_check", Checkbox(title=_("Disable certificate validation"),
|
||||||
|
help=_("Activate to disable certificate validation (not recommended), optional"))),
|
||||||
|
],
|
||||||
|
optional_keys=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
rulespec_registry.register(
|
||||||
|
HostRulespec(
|
||||||
|
group=RulespecGroupDatasourceProgramsCustom,
|
||||||
|
name="special_agents:mailcow",
|
||||||
|
valuespec=_valuespec_special_agent_mailcow,
|
||||||
|
)
|
||||||
|
)
|
BIN
mkp/Mailcow-0.1.0.mkp
Executable file
BIN
mkp/Mailcow-0.1.0.mkp
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user