Exemple #1
0
def stop_ns_monitoring(nsId):
    """
    Contact with the monitoring manager to delete the monitoring jobs and the dashboard
    Parameters
    ----------
    nsId: string 
        String identifying the network service
    Returns
    -------
    None
    """
    # parse NSD / VNFDs to get the list of montoring jobs to be configured and its information
    if monitoring_pushgateway == "no":
        job_ids = ns_db.get_monitoring_info(nsId)
        for job_id in job_ids:
            stop_monitoring_job(job_id['exporterId'])
        # delete monitor jobs from database by posting an empty list
        ns_db.set_monitoring_info(nsId, [])
        dashboard_info = ns_db.get_dashboard_info(nsId)
        if "dashboardId" in dashboard_info.keys():
            stop_dashboard(dashboard_info["dashboardId"])
            ns_db.set_dashboard_info(nsId, {})
    else:
        job_ids = ns_db.get_monitoring_info(nsId)
        for job_id in job_ids:
            stop_monitoring_job(job_id['exporterId'])
            stop_exporters_on_rvm_agent(job_id)
            delete_rvm_agent(job_id['agent_id'])
        # delete monitor jobs from database by posting an empty list
        ns_db.set_monitoring_info(nsId, [])
        dashboard_info = ns_db.get_dashboard_info(nsId)
        if "dashboardId" in dashboard_info.keys():
            stop_dashboard(dashboard_info["dashboardId"])
            ns_db.set_dashboard_info(nsId, {})
Exemple #2
0
def configure_ns_monitoring(nsId, nsd, vnfds, deployed_vnfs_info):
    """
    Contact with the monitoring manager to configure the monitoring jobs and the dashboard
    Parameters
    ----------
    nsId: string 
        String identifying the network service
    nsd: json
        Network service descriptor
    vnfds: json
        VNF descriptor
    deployed_vnfs_info: dict
        Dictionary with information of the saps of the deployed vnfs in a network service
    Returns
    -------
    None
    """
    # parse NSD / VNFDs to get the list of monitoring jobs to be configured and its information
    # ! we need the input of the vnfds, to have the endpoints!
    jobs = get_pm_jobs_v2(nsd, deployed_vnfs_info, nsId)
    # for each job request the Monitoring Configuration Manager to configure the job and save the job_id
    job_ids = []
    for job in jobs:
        job_elem = configure_monitoring_job(job)
        job_ids.append(job_elem)
    # save the list of jobs in the database
    ns_db.set_monitoring_info(nsId, job_ids)
    # create the dashboard for the monitoring jobs
    dashboard_id = configure_dashboard_v2(nsId, jobs)
    ns_db.set_dashboard_info(nsId, dashboard_id)
Exemple #3
0
def update_ns_monitoring(nsId, nsd, vnfds, deployed_vnfs_info):
    """
    Contact with the monitoring manager to update the monitoring jobs and the dashboard
    Parameters
    ----------
    nsId: string 
        String identifying the network service
    nsd: json
        Network service descriptor
    vnfds: json
        VNF descriptor
    deployed_vnfs_info: dict
        Dictionary with information of the saps of the deployed vnfs in a network service
    Returns
    -------
    None
    """
    if monitoring_pushgateway == "no":
        new_jobs = []  # result of scale out operations
        old_jobs = []  # result of scale in operations
        job_ids = []
        [new_jobs, old_jobs] = update_pm_jobs(nsId, deployed_vnfs_info)
        for job in new_jobs:
            job_elem = configure_monitoring_job(job)
            job_ids.append(job_elem)
        # update the list of jobs in the database
        for job in old_jobs:
            stop_monitoring_job(job)
        ns_db.update_monitoring_info(nsId, job_ids, old_jobs)
        # update the dashboard for the monitoring jobs: once all required ones have been created or erased
        jobs = ns_db.get_monitoring_info(nsId)
        dashboard_info = ns_db.get_dashboard_info(nsId)
        if "dashboardId" in dashboard_info.keys():
            stop_dashboard(dashboard_info["dashboardId"])
        dashboard_id = configure_dashboard_v2(nsId, jobs)
        # we rewrite the dasboard info
        ns_db.set_dashboard_info(nsId, dashboard_id)
    else:
        new_jobs = []  # result of scale out operations
        old_jobs = []  # result of scale in operations
        job_ids = []
        [new_jobs,
         old_jobs] = update_pm_jobs_rvm_agents(nsId, deployed_vnfs_info)
        for job in new_jobs:
            job_elem = configure_monitoring_job_prometheus(job)
            job_elem = start_exporters_on_rvm_agent(job_elem)
            job_ids.append(job_elem)
        # update the list of jobs in the database
        old_jobs_ids = []
        for job_id in old_jobs:
            stop_monitoring_job(job_id['exporterId'])
            stop_exporters_on_rvm_agent(job_id)
            delete_rvm_agent(job_id['agent_id'])
            old_jobs_ids.append(job_id['exporterId'])
        ns_db.update_monitoring_info(nsId, job_ids, old_jobs_ids)