From: vegall Date: Wed, 27 Apr 2022 15:56:04 +0000 (+0000) Subject: Feature 10920: Monitoring of NFVI-leve VNF metrics form Prometheus TSDB X-Git-Tag: v12.0.0rc1~13 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F53%2F11953%2F4;p=osm%2Fosmclient.git Feature 10920: Monitoring of NFVI-leve VNF metrics form Prometheus TSDB Change-Id: Id1c9782735de51b5348b8930de9c4cdd5d81f406 Signed-off-by: vegall --- diff --git a/osmclient/scripts/osm.py b/osmclient/scripts/osm.py index 58b34c5..3ce02df 100755 --- a/osmclient/scripts/osm.py +++ b/osmclient/scripts/osm.py @@ -3154,6 +3154,7 @@ def pdu_delete(ctx, name, force): ) @click.option("--vca", default=None, help="VCA to be used in this VIM account") @click.option("--creds", default=None, help="credentials file (only applycable for GCP VIM type)") +@click.option("--prometheus_config_file", default=None, help="Prometheus configuration to get VIM data") @click.pass_context def vim_create( ctx, @@ -3171,6 +3172,7 @@ def vim_create( wait, vca, creds, + prometheus_config_file ): """creates a new VIM account""" logger.debug("") @@ -3180,6 +3182,11 @@ def vim_create( if sdn_port_mapping: check_client_version(ctx.obj, "--sdn_port_mapping") vim = {} + if prometheus_config_file: + with open(prometheus_config_file) as prometheus_file: + prometheus_config_dict = json.load(prometheus_file) + vim["prometheus-config"] = prometheus_config_dict + vim["vim-username"] = user vim["vim-password"] = password vim["vim-url"] = auth_url @@ -3229,6 +3236,7 @@ def vim_create( "until the operation is completed, or timeout", ) @click.option("--creds", default=None, help="credentials file (only applycable for GCP VIM type)") +@click.option("--prometheus_config_file", default=None, help="Prometheus configuration to get VIM data") @click.pass_context def vim_update( ctx, @@ -3246,6 +3254,7 @@ def vim_update( sdn_port_mapping, wait, creds, + prometheus_config_file ): """updates a VIM account @@ -3275,6 +3284,10 @@ def vim_update( if creds: with open(creds, "r") as cf: vim_config["credentials"] = yaml.safe_load(cf.read()) + if prometheus_config_file: + with open(prometheus_config_file) as prometheus_file: + prometheus_config_dict = json.load(prometheus_file) + vim["prometheus-config"] = prometheus_config_dict logger.info(f"VIM: {vim}, VIM config: {vim_config}") ctx.obj.vim.update(name, vim, vim_config, sdn_controller, sdn_port_mapping, wait=wait) # except ClientException as e: