sonata-nfv/tng-portal

[Bug] Portal dashboard fails requesting information

Closed this issue · 7 comments

Review Portal dashboard environments requested.
pre-int... is requested instead of the environment in use.

cc @felipevicens

I leave here a log from @sinaure

November 21st 2019, 16:37:39.026 tng-sec-gtw 192.168.2.36 - - [21/Nov/2019:15:37:39 +0000] "GET /api/v3/monitoring/graphs/d-solo/sp_dash/sp?orgId=1&panelId=3&var-id=4fd837f6-5f49-11dc-a9ed-000ea629289b&var-entity=vm&var-env=pre-int-vnv-bcn.5gtango.eu%3A4fd837f6-5f49-11dc-a9ed-000ea629289b&theme=light&refresh=10s HTTP/1.1" 200 23950 "http://192.168.1.181/dashboard" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36" "-"

Hi, as commented yesterday:

  • Portal takes the graph name with all its attributes. Portal is not able to predict that var-env will be pre-int-vnv-bcn.5gtango.eu%3A4fd837f6-5f49-11dc-a9ed-000ea629289b with all that hash. The maximum I can do is to change the pre-int-vnv-bcn.5gtango.eu part for the location of the Portal but this will not solve anything with that following hash.
  • Regarding the d-solo/sp_dash/sp? part which is also static, that is how the graphs of all Grafanas I've seen (SP and V&V ones) define the URL to get the graphs. So I see nothing to change in there for Portal while this is like this.

Examples of graphs for VnV Host CPU usage from Grafana in SP and in V&V:
SP: https://pre-int-sp-ath.5gtango.eu/api/v3/monitoring/graphs/d/sp_dash/sp?orgId=1&from=1574738703848&to=1574760303848&var-id=341f4d56-8e66-cfae-6fb3-1143fff11091&var-entity=vm&var-env=pre-int-sp%3A341f4d56-8e66-cfae-6fb3-1143fff11091&panelId=17&fullscreen

V&V: https://pre-int-vnv-bcn.5gtango.eu/api/v3/monitoring/graphs/d/sp_dash/sp?orgId=1&from=1574738633860&to=1574760233860&var-id=4fd837f6-5f49-11dc-a9ed-000ea629289b&var-entity=vm&var-env=pre-int-vnv-bcn.5gtango.eu%3A4fd837f6-5f49-11dc-a9ed-000ea629289b&panelId=17&fullscreen

@pkarkazis please can you take a look to my last comment?

From an exchange with panos

Panos Karkazis @pkarkazis 7:54
Hello @sinaure,
I saw your issue in son-monitor (sonata-nfv/son-monitor#138) but I am not sure that I understood your point. Could you please provide me a more detailed description of the problem? For example, where the problem occurred, in which env did you notice it etc ?

aureliano sinatra @sinaure 09:35
Hi Panos, I've open this issue in duplicate with tng-api-gateway I am not sure is related with son monitor... Anyway this is the scenario:
I've installed the VnV on a VM in our 'EasyglobalMarket' dev environment (out of 5Gtango network)
we are of course in vpn
test plan execution stuck between tng-api-gateway and tng-vnv-planner
on the log stack I see
a reference to pre-int-vnv-bcn.5gtango.eu
my question is if I am using a local environment for the VnV and a remote SP (Aveiro in this case)
why do I have pre-int-vnv-bcn.5gtango.eu in the callback?
looks something hardcoded
I should have instead my internal IP

Panos Karkazis @pkarkazis 13:26
This query is originated from the portal asking a graph from monitoring (via tng-api-gtw), I suppose that the portal asks monitoring charts regarding the machine that hosts the vnv. I think that the most appropriate person to ask is @anapolg, probably you must use an env variable...

@pkarkazis this is the request for both SP

pre-int SP: https://pre-int-sp-ath.5gtango.eu/api/v3/monitoring/graphs/d/sp_dash/sp?orgId=1&from=1574738703848&to=1574760303848&var-id=341f4d56-8e66-cfae-6fb3-1143fff11091&var-entity=vm&var-env=pre-int-sp%3A341f4d56-8e66-cfae-6fb3-1143fff11091&panelId=17&fullscreen

int SP: https://int-sp-ath.5gtango.eu/api/v3/monitoring/graphs/d/sp_dash/sp?orgId=1&from=1574917674311&to=1574939274312&var-id=55de4d56-c17c-e77e-f2c1-fdc3f80404f6&var-entity=vm&var-env=int-sp-ath.5gtango.eu%3A55de4d56-c17c-e77e-f2c1-fdc3f80404f6&panelId=17&fullscreen

${ this.config.baseSP }${ this.config.graphs }/d-solo/sp_dash/sp?orgId=1&` +
			`panelId=${ panelId }&` +
			`var-id=341f4d56-8e66-cfae-6fb3-1143fff11091&` +
			`var-entity=vm&` +
			`var-env=pre-int-sp%3A341f4d56-8e66-cfae-6fb3-1143fff11091&` +
			`theme=light&` +
			`refresh=${ this.refreshRateGraphs }`

var-env= ${ window.location.origin }%3A${variable}& +
//pre-int-vnv-bcn.5gtango.eu%3A4fd837f6-5f49-11dc-a9ed-000ea629289b&

Request: curl -X GET "http://pre-int-vnv-bcn.5gtango.eu:8000/api/v2/prometheus/metrics/name/vm_mem_perc"

Response:

{
  "metrics": {
    "resultType": "vector",
    "result": [
      {
        "metric": {
          "__name__": "vm_mem_perc",
          "exported_instance": "pre-int-vnv-bcn.5gtango.eu:4fd837f6-5f49-11dc-a9ed-000ea629289b",
          "exported_job": "vm",
          "instance": "pushgateway:9091",
          "job": "pushgateway",
          "resource_id": "4fd837f6-5f49-11dc-a9ed-000ea629289b"
        },
        "value": [
          1574940909.247,
          "50.31"
        ]
      }
    ]
  }
}

Filter by name and the first part of exported_instance

It should be ready and working with PR: #477
It was merged to master branch so you can now deploy the new Portal version from master and try again to see if it works for you @sinaure .