def collect(self) -> List[Metric]:
metrics = []
vim_status = self.is_vim_ok()
- vim_status_metric = Metric({'vim_account_id': self.vim_account['_id']}, 'vim_status', vim_status)
+ vim_project_id = self.vim_account['_admin']['projects_read'][0]
+ vim_tags = {
+ 'vim_account_id': self.vim_account['_id'],
+ 'project_id': vim_project_id
+ }
+ vim_status_metric = Metric(vim_tags, 'vim_status', vim_status)
metrics.append(vim_status_metric)
vnfrs = self.common_db.get_vnfrs(vim_account_id=self.vim_account['_id'])
for vnfr in vnfrs:
nsr_id = vnfr['nsr-id-ref']
+ ns_name = self.common_db.get_nsr(nsr_id)['name']
vnf_member_index = vnfr['member-vnf-index-ref']
+ vnfr_project_id = vnfr['_admin']['projects_read'][0]
for vdur in vnfr['vdur']:
if 'vim-id' not in vdur:
log.debug("Field vim-id is not present in vdur")
'vim_account_id': self.vim_account['_id'],
'resource_uuid': resource_uuid,
'nsr_id': nsr_id,
+ 'ns_name': ns_name,
'vnf_member_index': vnf_member_index,
- 'vdur_name': vdur['name']
+ 'vdur_name': vdur['name'],
+ 'project_id': vnfr_project_id
}
try:
vm = self.nova.servers.get(resource_uuid)
def collect(self) -> List[Metric]:
metrics = []
sdnc_status = self.is_sdnc_ok()
- sdnc_status_metric = Metric({'sdnc_id': self.sdnc['_id']}, 'sdnc_status', sdnc_status)
+ sdnc_project_id = self.sdnc['_admin']['projects_read'][0]
+ sdnc_tags = {
+ 'sdnc_id': self.sdnc['_id'],
+ 'project_id': sdnc_project_id
+ }
+ sdnc_status_metric = Metric(sdnc_tags, 'sdnc_status', sdnc_status)
metrics.append(sdnc_status_metric)
return metrics
self.admin_password = vim_account['admin_password']
self.vim_uuid = vim_account['vim_uuid']
self.org_name = vim_account['orgname']
+ self.vim_project_id = vim_account['project_id']
def connect_vim_as_admin(self):
""" Method connect as pvdc admin user to vCloud director.
vim_account_info['schema_version'],
vim_account_id)
vim_account['vim_uuid'] = vim_account_info['_id']
+ vim_account['project_id'] = vim_account_info['_admin']['projects_read'][0]
vim_config = vim_account_info['config']
vim_account['admin_username'] = vim_config['admin_username']
def collect(self) -> List[Metric]:
metrics = []
vim_status = self.check_vim_status()
- vim_status_metric = Metric({'vim_account_id': self.vim_account_id}, 'vim_status', vim_status)
+ vim_account_id = self.vim_account_id
+ vim_project_id = self.vim_project_id
+ vim_tags = {
+ 'vim_account_id': vim_account_id,
+ 'project_id': vim_project_id
+ }
+ vim_status_metric = Metric(vim_tags, 'vim_status', vim_status)
metrics.append(vim_status_metric)
- vnfrs = self.common_db.get_vnfrs(vim_account_id=self.vim_account_id)
+ vnfrs = self.common_db.get_vnfrs(vim_account_id=vim_account_id)
for vnfr in vnfrs:
nsr_id = vnfr['nsr-id-ref']
+ ns_name = self.common_db.get_nsr(nsr_id)['name']
vnf_member_index = vnfr['member-vnf-index-ref']
+ vnfr_project_id = vnfr['_admin']['projects_read'][0]
for vdur in vnfr['vdur']:
resource_uuid = vdur['vim-id']
tags = {
'vim_account_id': self.vim_account_id,
'resource_uuid': resource_uuid,
'nsr_id': nsr_id,
+ 'ns_name': ns_name,
'vnf_member_index': vnf_member_index,
- 'vdur_name': vdur['name']
+ 'vdur_name': vdur['name'],
+ 'project_id': vnfr_project_id
}
try:
vm_list = self.check_vm_status(resource_uuid)