def __init__(self): sites_callback = SitesCallback(cmk.gui.sites.states, bi_livestatus_query) self.compiler = BICompiler(self.bi_configuration_file(), sites_callback) self.compiler.load_compiled_aggregations() self.status_fetcher = BIStatusFetcher(sites_callback) self.computer = BIComputer(self.compiler.compiled_aggregations, self.status_fetcher)
class BIManager: def __init__(self): sites_callback = SitesCallback(cmk.gui.sites.states, bi_livestatus_query) self.compiler = BICompiler(self.bi_configuration_file(), sites_callback) self.compiler.load_compiled_aggregations() self.status_fetcher = BIStatusFetcher(sites_callback) self.computer = BIComputer(self.compiler.compiled_aggregations, self.status_fetcher) @classmethod def bi_configuration_file(cls) -> str: return str(Path(watolib.multisite_dir()) / "bi_config.bi")
def get_cached_bi_compiler() -> BICompiler: if "bi_compiler" not in g: sites_callback = SitesCallback(cmk.gui.sites.states, bi_livestatus_query) g.bi_compiler = BICompiler(BIManager.bi_configuration_file(), sites_callback) return g.bi_compiler
def get_cached_bi_compiler() -> BICompiler: return BICompiler( BIManager.bi_configuration_file(), SitesCallback(cmk.gui.sites.states, bi_livestatus_query) )