X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcollector%2Finfra_collectors%2Fbase_osinfra.py;fp=osm_mon%2Fcollector%2Finfra_collectors%2Fbase_osinfra.py;h=19a21f057acb0e87e0a365dff899628daa16c0bb;hb=ba2676e28c9b790cc0e3a60152b710522053eecb;hp=afbf2455b73aee5b3cfa8a694eaad13655a48bbe;hpb=f3d1c668ad8ffe5163847fc88effb2b411352e10;p=osm%2FMON.git diff --git a/osm_mon/collector/infra_collectors/base_osinfra.py b/osm_mon/collector/infra_collectors/base_osinfra.py index afbf245..19a21f0 100644 --- a/osm_mon/collector/infra_collectors/base_osinfra.py +++ b/osm_mon/collector/infra_collectors/base_osinfra.py @@ -55,6 +55,9 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector): nsr_id = vnfr['nsr-id-ref'] vnf_member_index = vnfr['member-vnf-index-ref'] for vdur in vnfr['vdur']: + if 'vim-id' not in vdur: + log.debug("Field vim-id is not present in vdur") + continue resource_uuid = vdur['vim-id'] tags = { 'vim_account_id': self.vim_account_id, @@ -67,8 +70,8 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector): vm = self.nova.servers.get(resource_uuid) vm_status = (1 if vm.status == 'ACTIVE' else 0) vm_status_metric = Metric(tags, 'vm_status', vm_status) - except Exception: - log.exception("VM status is not OK!") + except Exception as e: + log.warning("VM status is not OK: %s" % e) vm_status_metric = Metric(tags, 'vm_status', 0) metrics.append(vm_status_metric) @@ -78,8 +81,8 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector): try: self.nova.servers.list() return True - except Exception: - log.exception("VIM status is not OK!") + except Exception as e: + log.warning("VIM status is not OK: %s" % e) return False def _build_keystone_client(self, vim_account_id) -> keystone_client.Client: