self.timeout = config.timeout
self.ro_config = config.RO
self.vca_config = config.VCA
+ self.service_kpi = config.servicekpi
# create N2VC connector
self.n2vc = N2VCJujuConnector(
for vdur in monitored_vdurs:
vdu_id = vdur["vdu-id-ref"]
metric_name = vnf_monitoring_param.get("performance-metric")
- metric_name = f"osm_{metric_name}"
+ if "exporters-endpoints" not in df:
+ metric_name = f"osm_{metric_name}"
vnf_member_index = vnfr["member-vnf-index-ref"]
scalein_threshold = scaling_criteria.get(
"scale-in-threshold"
)
metric_selector = f'{metric_name}{{ns_id="{nsr_id}", vnf_member_index="{vnf_member_index}", vdu_id="{vdu_id}"}}'
expression = f"(count ({metric_selector}) > {instances_min_number}) and (avg({metric_selector}) {rel_operator} {scalein_threshold})"
+ if (
+ "exporters-endpoints" in df
+ and metric_name.startswith("kpi_")
+ ):
+ new_metric_name = (
+ f'osm_{metric_name.replace("kpi_", "").strip()}'
+ )
+ metric_port = df["exporters-endpoints"].get(
+ "metric-port", 9100
+ )
+ vdu_ip = vdur["ip-address"]
+ ip_port = str(vdu_ip) + ":" + str(metric_port)
+ metric_selector = (
+ f'{new_metric_name}{{instance="{ip_port}"}}'
+ )
+ expression = f"({metric_selector} {rel_operator} {scalein_threshold})"
labels = {
"ns_id": nsr_id,
"vnf_member_index": vnf_member_index,
)
metric_selector = f'{metric_name}{{ns_id="{nsr_id}", vnf_member_index="{vnf_member_index}", vdu_id="{vdu_id}"}}'
expression = f"(count ({metric_selector}) < {instances_max_number}) and (avg({metric_selector}) {rel_operator} {scaleout_threshold})"
+ if (
+ "exporters-endpoints" in df
+ and metric_name.startswith("kpi_")
+ ):
+ new_metric_name = (
+ f'osm_{metric_name.replace("kpi_", "").strip()}'
+ )
+ metric_port = df["exporters-endpoints"].get(
+ "metric-port", 9100
+ )
+ vdu_ip = vdur["ip-address"]
+ ip_port = str(vdu_ip) + ":" + str(metric_port)
+ metric_selector = (
+ f'{new_metric_name}{{instance="{ip_port}"}}'
+ )
+ expression = f"({metric_selector} {rel_operator} {scaleout_threshold})"
labels = {
"ns_id": nsr_id,
"vnf_member_index": vnf_member_index,
operation_state=nslcmop_operation_state,
other_update=db_nslcmop_update,
)
+ if nslcmop_operation_state == "COMPLETED":
+ self.db.del_list("prometheus_jobs", {"nsr_id": nsr_id})
if ns_state == "NOT_INSTANTIATED":
try:
self.db.set_list(
scale_process = None
# POST-SCALE END
# Check if each vnf has exporter for metric collection if so update prometheus job records
- if scaling_type == "SCALE_OUT":
+ if scaling_type == "SCALE_OUT" and bool(self.service_kpi.old_sa):
if "exporters-endpoints" in db_vnfd.get("df")[0]:
vnfr_id = db_vnfr["id"]
db_vnfr = self.db.get_one("vnfrs", {"_id": vnfr_id})