From: Gianpietro Lavado Date: Sun, 8 Dec 2019 20:21:10 +0000 (+0000) Subject: Fixes autoscaling with VNF Indicators X-Git-Tag: v7.0.0rc1~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F49%2F8349%2F2;p=osm%2FMON.git Fixes autoscaling with VNF Indicators Adds vdu_name to VNF Indicators collection. This fixes autoscaling as Prometheus is queried using alarm tags, which includes vdu_name. Change-Id: I68e6368e4839b96737142be426d82d1b1e07e186 Signed-off-by: Gianpietro Lavado --- diff --git a/osm_mon/collector/vnf_collectors/juju.py b/osm_mon/collector/vnf_collectors/juju.py index 8f3fa34..82ee98f 100644 --- a/osm_mon/collector/vnf_collectors/juju.py +++ b/osm_mon/collector/vnf_collectors/juju.py @@ -90,11 +90,19 @@ class VCACollector(BaseCollector): return metrics measures = self.loop.run_until_complete(self.n2vc.GetMetrics(vca_deployment_info['model'], vca_deployment_info['application'])) + # Search for Mgmt VDU name, needed to query Prometheus based on alarm tags + # TODO: check a better way to look for Mgmt VDU + for vdur in vnfr['vdur']: + for interface in vdur['interfaces']: + if 'mgmt-vnf' in interface: + vdu_name = vdur['name'] + break log.debug('Measures: %s', measures) for measure_list in measures.values(): for measure in measure_list: log.debug("Measure: %s", measure) - metric = VnfMetric(nsr_id, vnf_member_index, '', measure['key'], float(measure['value']), tags) + metric = VnfMetric(nsr_id, vnf_member_index, vdu_name, + measure['key'], float(measure['value']), tags) metrics.append(metric) return metrics