hbc proper termination, hbd config reloadable

This commit is contained in:
Andreas Wrede
2026-04-02 07:17:00 -04:00
parent 84c1aef51f
commit c5770006f7
15 changed files with 612 additions and 62 deletions
+25
View File
@@ -316,6 +316,31 @@ class ThresholdChecker:
total_thresholds
)
def reload(self, config: Dict[str, Any]):
"""Reload threshold configuration from new config dict.
This clears all existing thresholds and re-parses from the new configuration.
Alert states are preserved to maintain hysteresis across reloads.
Args:
config: New configuration dictionary
"""
logger.info("Reloading threshold configuration...")
# Clear old configuration
self.threshold_configs.clear()
self.thresholds.clear()
self.host_config_mapping.clear()
# Parse new configuration
self._parse_config(config)
total_thresholds = sum(len(cfg) for cfg in self.threshold_configs.values())
if total_thresholds == 0 and len(self.thresholds) > 0:
total_thresholds = len(self.thresholds)
logger.info("Threshold configuration reloaded: %d total thresholds", total_thresholds)
def _parse_config(self, config: Dict[str, Any]):
"""Parse threshold configuration from YAML structure.