From: agarwalat Date: Wed, 4 Nov 2020 05:18:46 +0000 (+0000) Subject: Fix bug 1276: collect metric from gnocchi first then ceilometer if it fails X-Git-Tag: release-v9.0-start~6 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F39%2F9939%2F3;p=osm%2FMON.git Fix bug 1276: collect metric from gnocchi first then ceilometer if it fails Change-Id: I1313f24c9881071ae52adff7a4881ac4dcc38ee6 Signed-off-by: agarwalat --- diff --git a/osm_mon/collector/vnf_collectors/openstack.py b/osm_mon/collector/vnf_collectors/openstack.py index df0424b..7de93ec 100644 --- a/osm_mon/collector/vnf_collectors/openstack.py +++ b/osm_mon/collector/vnf_collectors/openstack.py @@ -142,15 +142,15 @@ class OpenstackCollector(BaseVimCollector): def _get_backend(self, vim_account: dict): try: - ceilometer = CeilometerBackend(vim_account) - ceilometer.client.capabilities.get() - log.info("Using ceilometer backend to collect metric") - return ceilometer - except (HTTPException, EndpointNotFound): gnocchi = GnocchiBackend(vim_account) gnocchi.client.metric.list(limit=1) log.info("Using gnocchi backend to collect metric") return gnocchi + except (HTTPException, EndpointNotFound): + ceilometer = CeilometerBackend(vim_account) + ceilometer.client.capabilities.get() + log.info("Using ceilometer backend to collect metric") + return ceilometer def _get_metric_type(self, metric_name: str, interface_name: str) -> MetricType: if metric_name not in INTERFACE_METRICS: