MKP 3.2.0 released, fixed bugs when users are deleted and rules without levels are active
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
# pylint: disable=missing-module-docstring, unused-argument, missing-function-docstring
|
||||
# pylint: disable=line-too-long
|
||||
|
||||
from typing import Final
|
||||
from collections.abc import Mapping
|
||||
from typing import NotRequired, TypedDict
|
||||
|
||||
@@ -18,6 +19,8 @@ from cmk.agent_based.v2 import (
|
||||
DiscoveryResult,
|
||||
)
|
||||
|
||||
NO_LEVELS: Final[str] = "no_levels"
|
||||
|
||||
|
||||
class _ItemData(TypedDict):
|
||||
dbtype: NotRequired[str]
|
||||
@@ -49,14 +52,18 @@ def check_nextcloud_database(params, section) -> CheckResult:
|
||||
size = section[key]["size"]
|
||||
dbtype = section[key]["dbtype"]
|
||||
version = section[key]["version"]
|
||||
_level_type, levels = params["levels_database_opcache_hit_rate"]
|
||||
level_type, levels = params["levels_database_opcache_hit_rate"]
|
||||
# create graph for opcache hit rate
|
||||
yield Metric(
|
||||
"nc_database_opcache_hit_rate", opcache_hit_rate, levels=levels
|
||||
)
|
||||
if level_type == NO_LEVELS:
|
||||
yield Metric("nc_database_opcache_hit_rate", opcache_hit_rate)
|
||||
state = State.OK
|
||||
else:
|
||||
yield Metric(
|
||||
"nc_database_opcache_hit_rate", opcache_hit_rate, levels=levels
|
||||
)
|
||||
state = get_state_lower(levels, opcache_hit_rate)
|
||||
# create graph for database size
|
||||
yield Metric("nc_database_size", size)
|
||||
state = get_state_lower(levels, opcache_hit_rate)
|
||||
summary = f"PHP OPCache hit rate: {render.percent(opcache_hit_rate)}"
|
||||
if opcache_hit_rate == 0:
|
||||
state = State.UNKNOWN
|
||||
|
||||
Reference in New Issue
Block a user