|
@@ -39,8 +39,6 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
item_detail = item.split()[-1]
|
|
|
data = section.get(item)
|
|
|
warn, crit = params.get("levels", ("fixed", (None, None)))[1]
|
|
|
- # The warn and crit you can use than later inside a check_levels function
|
|
|
- # print(f"Levels - {warn} - {crit}")
|
|
|
if not data:
|
|
|
return
|
|
|
for key, value in data.items():
|
|
@@ -62,10 +60,11 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
'''create a default result if above criteria do not apply'''
|
|
|
warn, crit = params.get((item.lower()).replace(" ", "_"), {}).get(key, ("fixed", (None, None)))[1]
|
|
|
if warn is not None or crit is not None:
|
|
|
- #print(f"Levels {key} - {warn} - {crit}")
|
|
|
if (item_detail + "_" + key) in total_counter_attributes:
|
|
|
previous_value = value_store.get(key, 0)
|
|
|
value_store[key] = value
|
|
|
+ if (previous_value > value):
|
|
|
+ previous_value = 0
|
|
|
value_difference = int(value) - int(previous_value)
|
|
|
yield from check_levels(
|
|
|
int(math.ceil(value_difference)),
|
|
@@ -73,7 +72,7 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
label=key,
|
|
|
metric_name=key,
|
|
|
notice_only=True,
|
|
|
- )
|
|
|
+ )
|
|
|
else:
|
|
|
yield from check_levels(
|
|
|
int(value),
|
|
@@ -81,7 +80,7 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
label=key,
|
|
|
metric_name=key,
|
|
|
notice_only=True,
|
|
|
- )
|
|
|
+ )
|
|
|
else:
|
|
|
yield Result(state=State(0), notice=f"{key}: {value}", details=f"{key}: {value}")
|
|
|
if (item_detail + "_" + key) in total_counter_attributes:
|
|
@@ -90,8 +89,6 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
value_store[key] = value
|
|
|
value_difference = int(value) - int(previous_value)
|
|
|
yield Metric((item_detail + "_" + key), abs(value_difference), boundaries=(0, None))
|
|
|
- elif item.startswith("IDM") and key in idm_nongraphable_attributes:
|
|
|
- continue
|
|
|
elif (item_detail + "_" + key) not in non_graphable_attributes:
|
|
|
'''Only create a metric for graphable values'''
|
|
|
yield Metric((item_detail + "_" + key), abs(int(value)))
|
|
@@ -99,7 +96,7 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
|
|
|
agent_section_edirectory_monitor_dhost = AgentSection(
|
|
|
name="edirectory_monitor_dhost",
|
|
|
parse_function=parse_ldap_data,
|
|
|
- )
|
|
|
+)
|
|
|
|
|
|
check_plugin_edirectory_monitor_dhost = CheckPlugin(
|
|
|
name="edirectory_monitor_dhost",
|