113 lines
3.9 KiB
Python
113 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
# pylint: disable=unused-import
|
|
"""graphing and metrics definitions"""
|
|
|
|
from cmk.graphing.v1 import Title
|
|
from cmk.graphing.v1.graphs import Graph, MinimalRange
|
|
from cmk.graphing.v1.metrics import Color, DecimalNotation, Metric, Unit
|
|
from cmk.graphing.v1.perfometers import Closed, FocusRange, Perfometer
|
|
|
|
## Metrics
|
|
# metrics must begin with "metric_" and be an instance of "Metric"
|
|
|
|
# Global metrics
|
|
metric_mc_num_domains = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mc_num_domains",
|
|
title=Title("Number of email domains"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_ORANGE,
|
|
)
|
|
metric_mc_num_global_messages = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mc_num_global_messages",
|
|
title=Title("Global number of messages"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_CYAN,
|
|
)
|
|
metric_mc_num_mailboxes = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mc_num_mailboxes",
|
|
title=Title("Number of mailboxes"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_GREEN,
|
|
)
|
|
|
|
# Mailbox Metrics
|
|
|
|
metric_mc_mailboxes_used_quota = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_mailboxes_used_quota",
|
|
title=Title("Percentage of mailbox quota used"),
|
|
unit=Unit(DecimalNotation("%")),
|
|
color=Color.DARK_ORANGE,
|
|
)
|
|
metric_mc_mailboxes_messages = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_mailboxes_messages",
|
|
title=Title("Number of messages in mailbox"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_RED,
|
|
)
|
|
|
|
# Domain metrics
|
|
metric_mc_domains_used_quota = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_used_quota",
|
|
title=Title("Percentage of domain quota used"),
|
|
unit=Unit(DecimalNotation("%")),
|
|
color=Color.DARK_ORANGE,
|
|
)
|
|
metric_mc_domains_mailboxes = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_mailboxes",
|
|
title=Title("Percentage of maximum mailboxes used"),
|
|
unit=Unit(DecimalNotation("%")),
|
|
color=Color.DARK_GREEN,
|
|
)
|
|
metric_mc_domains_aliases = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_aliases",
|
|
title=Title("Percentage of maximum aliases used"),
|
|
unit=Unit(DecimalNotation("%")),
|
|
color=Color.DARK_BLUE,
|
|
)
|
|
metric_mc_domains_messages = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_messages",
|
|
title=Title("Number of messages"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_RED,
|
|
)
|
|
metric_mc_domains_configured_aliases = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_configured_aliases",
|
|
title=Title("Number of configured aliases"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_CYAN,
|
|
)
|
|
metric_mc_domains_configured_mailboxes = Metric(
|
|
# "name" must be exactly the "metric_name" within the check function
|
|
name="mailcow_domains_configured_mailboxes",
|
|
title=Title("Number of configured mailboxes"),
|
|
unit=Unit(DecimalNotation("")),
|
|
color=Color.DARK_PINK,
|
|
)
|
|
|
|
## Perfometers
|
|
# perfometers must begin with "perfometer_" and be an instance of "Perfometer"
|
|
|
|
perfometer_mc_domains_used_quota = Perfometer(
|
|
name="mailcow_domains_used_quota",
|
|
focus_range=FocusRange(Closed(0), Closed(100)),
|
|
# "segments" must be exactly the name of the metric
|
|
segments=["mailcow_domains_used_quota"],
|
|
)
|
|
|
|
perfometer_mc_mailboxes_used_quota = Perfometer(
|
|
name="mailcow_mailboxes_used_quota",
|
|
focus_range=FocusRange(Closed(0), Closed(100)),
|
|
# "segments" must be exactly the name of the metric
|
|
segments=["mailcow_mailboxes_used_quota"],
|
|
)
|