|  | @@ -32,14 +32,16 @@ from cmk_addons.plugins.edirectory_monitor.lib import (
 | 
											
												
													
														|  |      total_counter_attributes,
 |  |      total_counter_attributes,
 | 
											
												
													
														|  |  )
 |  |  )
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +total_counters = [
 | 
											
												
													
														|  | 
 |  | +    "OutBoundContext_ActiveOutBoundContextCount",
 | 
											
												
													
														|  | 
 |  | +    "OutBoundContext_TotalOutBoundContextCount",
 | 
											
												
													
														|  | 
 |  | +]
 | 
											
												
													
														|  |  def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> CheckResult:
 |  |  def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> CheckResult:
 | 
											
												
													
														|  |      value_store = get_value_store()
 |  |      value_store = get_value_store()
 | 
											
												
													
														|  |      '''Split the item key and store the last part for making the returned result and/or metric more unique'''
 |  |      '''Split the item key and store the last part for making the returned result and/or metric more unique'''
 | 
											
												
													
														|  |      item_detail = item.split()[-1]
 |  |      item_detail = item.split()[-1]
 | 
											
												
													
														|  |      data = section.get(item)
 |  |      data = section.get(item)
 | 
											
												
													
														|  |      warn, crit = params.get("levels", ("fixed", (None, None)))[1]
 |  |      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:
 |  |      if not data:
 | 
											
												
													
														|  |          return
 |  |          return
 | 
											
												
													
														|  |      for key, value in data.items():
 |  |      for key, value in data.items():
 | 
											
										
											
												
													
														|  | @@ -61,10 +63,11 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
 | 
											
												
													
														|  |              '''create a default result if above criteria do not apply'''
 |  |              '''create a default result if above criteria do not apply'''
 | 
											
												
													
														|  |              warn, crit = params.get((item.lower()).replace(" ", "_"), {}).get(key, ("fixed", (None, None)))[1]
 |  |              warn, crit = params.get((item.lower()).replace(" ", "_"), {}).get(key, ("fixed", (None, None)))[1]
 | 
											
												
													
														|  |              if warn is not None or crit is not None:
 |  |              if warn is not None or crit is not None:
 | 
											
												
													
														|  | -                #print(f"Levels {key} - {warn} - {crit}")
 |  | 
 | 
											
												
													
														|  |                  if (item_detail + "_" + key) in total_counter_attributes:
 |  |                  if (item_detail + "_" + key) in total_counter_attributes:
 | 
											
												
													
														|  |                      previous_value = value_store.get(key, 0)
 |  |                      previous_value = value_store.get(key, 0)
 | 
											
												
													
														|  |                      value_store[key] = value
 |  |                      value_store[key] = value
 | 
											
												
													
														|  | 
 |  | +                    if (previous_value > value):
 | 
											
												
													
														|  | 
 |  | +                        previous_value = 0
 | 
											
												
													
														|  |                      value_difference = int(value) - int(previous_value)
 |  |                      value_difference = int(value) - int(previous_value)
 | 
											
												
													
														|  |                      yield from check_levels(
 |  |                      yield from check_levels(
 | 
											
												
													
														|  |                          int(math.ceil(value_difference)),
 |  |                          int(math.ceil(value_difference)),
 | 
											
										
											
												
													
														|  | @@ -72,7 +75,7 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
 | 
											
												
													
														|  |                          label=key,
 |  |                          label=key,
 | 
											
												
													
														|  |                          metric_name=key,
 |  |                          metric_name=key,
 | 
											
												
													
														|  |                          notice_only=True,
 |  |                          notice_only=True,
 | 
											
												
													
														|  | -                        )
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    )
 | 
											
												
													
														|  |                  else:
 |  |                  else:
 | 
											
												
													
														|  |                      yield from check_levels(
 |  |                      yield from check_levels(
 | 
											
												
													
														|  |                          int(value),
 |  |                          int(value),
 | 
											
										
											
												
													
														|  | @@ -80,7 +83,7 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
 | 
											
												
													
														|  |                          label=key,
 |  |                          label=key,
 | 
											
												
													
														|  |                          metric_name=key,
 |  |                          metric_name=key,
 | 
											
												
													
														|  |                          notice_only=True,
 |  |                          notice_only=True,
 | 
											
												
													
														|  | -                        )
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    )
 | 
											
												
													
														|  |              else:
 |  |              else:
 | 
											
												
													
														|  |                  yield Result(state=State(0), notice=f"{key}: {value}", details=f"{key}: {value}")
 |  |                  yield Result(state=State(0), notice=f"{key}: {value}", details=f"{key}: {value}")
 | 
											
												
													
														|  |          if (item_detail + "_" + key) in total_counter_attributes:
 |  |          if (item_detail + "_" + key) in total_counter_attributes:
 | 
											
										
											
												
													
														|  | @@ -91,12 +94,12 @@ def check_edirectory_items(item: str, params: Mapping[str, Any], section) -> Che
 | 
											
												
													
														|  |              yield Metric((item_detail + "_" + key), abs(value_difference), boundaries=(0, None))
 |  |              yield Metric((item_detail + "_" + key), abs(value_difference), boundaries=(0, None))
 | 
											
												
													
														|  |          elif (item_detail + "_" + key) not in non_graphable_attributes:
 |  |          elif (item_detail + "_" + key) not in non_graphable_attributes:
 | 
											
												
													
														|  |              '''Only create a metric for graphable values'''
 |  |              '''Only create a metric for graphable values'''
 | 
											
												
													
														|  | -            yield Metric((item_detail + "_" + key), abs(int(value)))
 |  | 
 | 
											
												
													
														|  | 
 |  | +            yield Metric(key, abs(int(value)))
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  agent_section_edirectory_monitor_dhost = AgentSection(
 |  |  agent_section_edirectory_monitor_dhost = AgentSection(
 | 
											
												
													
														|  |      name="edirectory_monitor_dclient",
 |  |      name="edirectory_monitor_dclient",
 | 
											
												
													
														|  |      parse_function=parse_ldap_data,
 |  |      parse_function=parse_ldap_data,
 | 
											
												
													
														|  | -    )
 |  | 
 | 
											
												
													
														|  | 
 |  | +)
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  check_plugin_edirectory_monitor_dclient = CheckPlugin(
 |  |  check_plugin_edirectory_monitor_dclient = CheckPlugin(
 | 
											
												
													
														|  |      name="edirectory_monitor_dclient",
 |  |      name="edirectory_monitor_dclient",
 |