예제 #1
0
 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)
예제 #2
0
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")
예제 #3
0
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
예제 #4
0
def get_cached_bi_compiler() -> BICompiler:
    return BICompiler(
        BIManager.bi_configuration_file(), SitesCallback(cmk.gui.sites.states, bi_livestatus_query)
    )