diff --git a/aviso-server/monitoring/aviso_monitoring/reporter/aviso_auth_reporter.py b/aviso-server/monitoring/aviso_monitoring/reporter/aviso_auth_reporter.py index 7a118f8..8d50cd9 100644 --- a/aviso-server/monitoring/aviso_monitoring/reporter/aviso_auth_reporter.py +++ b/aviso-server/monitoring/aviso_monitoring/reporter/aviso_auth_reporter.py @@ -198,6 +198,7 @@ def __init__(self, *args, **kwargs): self.critical_t = kwargs["critical_t"] self.req_timeout = kwargs["req_timeout"] self.metric_server_url = kwargs["metric_server_url"] + self.opsview_reporter = OpsviewReporter() super().__init__(*args, **kwargs) def metric(self): @@ -209,13 +210,13 @@ def metric(self): # fetch the cluster metrics if self.metric_server_url: - metrics = OpsviewReporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[ + metrics = self.opsview_reporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[ self.metric_server_url ] if metrics: logger.debug(f"Processing tlm {self.metric_name}...") - av_pod = OpsviewReporter.read_from_metrics(metrics, pattern) + av_pod = self.opsview_reporter.read_from_metrics(metrics, pattern) if av_pod: av_pod = int(av_pod) if av_pod <= self.critical_t: diff --git a/aviso-server/monitoring/aviso_monitoring/reporter/aviso_rest_reporter.py b/aviso-server/monitoring/aviso_monitoring/reporter/aviso_rest_reporter.py index da520a8..cfa1e66 100644 --- a/aviso-server/monitoring/aviso_monitoring/reporter/aviso_rest_reporter.py +++ b/aviso-server/monitoring/aviso_monitoring/reporter/aviso_rest_reporter.py @@ -179,6 +179,7 @@ def __init__(self, *args, **kwargs): self.critical_t = kwargs["critical_t"] self.req_timeout = kwargs["req_timeout"] self.metric_server_url = kwargs["metric_server_url"] + self.opsview_reporter = OpsviewReporter() super().__init__(*args, **kwargs) def metric(self): @@ -190,13 +191,13 @@ def metric(self): # fetch the cluster metrics if self.metric_server_url: - metrics = OpsviewReporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[ + metrics = self.opsview_reporter.retrieve_metrics([self.metric_server_url], self.req_timeout)[ self.metric_server_url ] if metrics: logger.debug(f"Processing tlm {self.metric_name}...") - av_pod = OpsviewReporter.read_from_metrics(metrics, pattern) + av_pod = self.opsview_reporter.read_from_metrics(metrics, pattern) if av_pod: av_pod = int(av_pod) if av_pod <= self.critical_t: diff --git a/aviso-server/monitoring/aviso_monitoring/reporter/etcd_reporter.py b/aviso-server/monitoring/aviso_monitoring/reporter/etcd_reporter.py index 6d6900b..bb705c7 100644 --- a/aviso-server/monitoring/aviso_monitoring/reporter/etcd_reporter.py +++ b/aviso-server/monitoring/aviso_monitoring/reporter/etcd_reporter.py @@ -23,6 +23,7 @@ def __init__(self, config, *args, **kwargs): self.req_timeout = self.etcd_config["req_timeout"] self.member_urls = self.etcd_config["member_urls"] self.tlms = self.etcd_config["tlms"] + self.opsview_reporter = OpsviewReporter() super().__init__(config, *args, **kwargs) def process_messages(self): @@ -33,7 +34,7 @@ def process_messages(self): logger.debug("Etcd processing metrics...") # fetch the raw tlms provided by etcd - raw_tlms = OpsviewReporter.retrieve_metrics(self.member_urls, self.req_timeout) # noqa: F841 + raw_tlms = self.opsview_reporter.retrieve_metrics(self.member_urls, self.req_timeout) # noqa: F841 # array of metric to return metrics = []