X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fosm_ngsa%2Fdags%2Fmultivim_vm_metrics.py;h=acec04d5cfa2e52bc2754bb3c5d82c5a613cb3f6;hb=54c033b73391a95c16f8ec737a9970072763acb2;hp=72ceca454bfa5b7ce114b423f4033c7f929ec48a;hpb=0e5ef56b157305e4952faaa5c53c89a9dd6790d2;p=osm%2FNG-SA.git diff --git a/src/osm_ngsa/dags/multivim_vm_metrics.py b/src/osm_ngsa/dags/multivim_vm_metrics.py index 72ceca4..acec04d 100644 --- a/src/osm_ngsa/dags/multivim_vm_metrics.py +++ b/src/osm_ngsa/dags/multivim_vm_metrics.py @@ -23,13 +23,15 @@ from airflow import DAG from airflow.decorators import task from osm_mon.core.common_db import CommonDbClient from osm_mon.core.config import Config +from osm_mon.vim_connectors.azure import AzureCollector +from osm_mon.vim_connectors.gcp import GcpCollector from osm_mon.vim_connectors.openstack import OpenStackCollector from prometheus_client import CollectorRegistry, Gauge, push_to_gateway SCHEDULE_INTERVAL = 5 COLLECTOR_MAX_METRICS_PER_TASK = 100 -SUPPORTED_VIM_TYPES = ["openstack", "vio"] +SUPPORTED_VIM_TYPES = ["openstack", "vio", "azure", "gcp"] PROMETHEUS_PUSHGW = "pushgateway-prometheus-pushgateway:9091" PROMETHEUS_JOB_PREFIX = "airflow_osm_vm_metrics_" PROMETHEUS_METRICS = { @@ -111,7 +113,6 @@ def create_dag(dag_id, dag_number, dag_description, vim_id): }, description=dag_description, is_paused_upon_creation=False, - # schedule_interval=timedelta(minutes=SCHEDULE_INTERVAL), schedule_interval=f"*/{SCHEDULE_INTERVAL} * * * *", start_date=datetime(2022, 1, 1), tags=["osm", "vdu"], @@ -225,8 +226,12 @@ def create_dag(dag_id, dag_number, dag_description, vim_id): vim_type = vim_account["config"]["vim_type"].lower() if vim_type == "vio" and "vrops_site" not in vim_account["config"]: vim_type = "openstack" - if vim_type == "openstack": + if vim_type == "openstack" or vim_type == "vio": collector = OpenStackCollector(vim_account) + elif vim_type == "azure": + collector = AzureCollector(vim_account) + elif vim_type == "gcp": + collector = GcpCollector(vim_account) else: logger.error(f"VIM type '{vim_type}' not supported") return None