MKP 0.2.0 released, bugfixes for rules with no levels set
This commit is contained in:
BIN
mkp/Traefik-0.2.0.mkp
Normal file
BIN
mkp/Traefik-0.2.0.mkp
Normal file
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
# pylint: disable=missing-module-docstring, unused-argument,
|
||||
# pylint: disable=missing-function-docstring, line-too-long
|
||||
|
||||
|
||||
import datetime
|
||||
import time
|
||||
|
||||
@@ -24,6 +25,9 @@ def get_state_upper(
|
||||
levels: tuple[int | float, int | float], value: int | float
|
||||
) -> State:
|
||||
"""returns OK/WARN/CRIT depending on the given parameters"""
|
||||
if levels is None:
|
||||
# a rule with no levels set is active, assume OK state
|
||||
return State.OK
|
||||
warn, crit = levels
|
||||
if value >= crit:
|
||||
return State.CRIT
|
||||
@@ -62,6 +66,9 @@ def check_traefik_info(params, section) -> CheckResult:
|
||||
"""the check function"""
|
||||
_level_type, levels = params["levels_traefik_agent_execution_time"]
|
||||
codename: str = section["codename"]
|
||||
if codename == "":
|
||||
# docker hardened image
|
||||
codename = "DHI"
|
||||
version: str = section["version"]
|
||||
startdate: str = section["startdate"]
|
||||
startdate_seconds_since_epoch: int = section["startdate_seconds_since_epoch"]
|
||||
@@ -71,7 +78,6 @@ def check_traefik_info(params, section) -> CheckResult:
|
||||
agent_version: str = section["agent_version"]
|
||||
agent_runtime: float = round(section["agent_runtime"], 1)
|
||||
state: State = get_state_upper(levels=levels, value=agent_runtime)
|
||||
|
||||
yield Metric(
|
||||
name="traefik_agent_execution_time",
|
||||
value=agent_runtime,
|
||||
|
||||
Reference in New Issue
Block a user