Traefik-CheckMK/graphing/graph_traefik.py

54 lines
1.6 KiB
Python

# 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
metric_traefik_agent_execution_time = Metric(
# "name" must be exactly the "metric_name" within the check function
name="traefik_agent_execution_time",
title=Title("Agent execution time"),
unit=Unit(DecimalNotation("ms")),
color=Color.DARK_ORANGE,
)
metric_traefik_num_http_routers = Metric(
name="traefik_num_http_routers",
title=Title("Number of HTTP routers"),
unit=Unit(DecimalNotation("")),
color=Color.LIGHT_GREEN,
)
metric_traefik_num_http_services = Metric(
name="traefik_num_http_services",
title=Title("Number of HTTP services"),
unit=Unit(DecimalNotation("")),
color=Color.LIGHT_BLUE,
)
metric_traefik_num_http_middlewares = Metric(
name="traefik_num_http_middlewares",
title=Title("Number of HTTP middlewares"),
unit=Unit(DecimalNotation("")),
color=Color.LIGHT_RED,
)
metric_traefik_percent_http_components_not_ok = Metric(
name="traefik_percent_http_components_not_ok",
title=Title("Percent of HTTP components in not OK state"),
unit=Unit(DecimalNotation("%")),
color=Color.DARK_RED,
)
perfometer_traefik_agent_execution_time = Perfometer(
name="traefik_agent_execution_time",
focus_range=FocusRange(Closed(0), Closed(100)),
# "segments" must be exactly the name of the metric
segments=["traefik_agent_execution_time"],
)