diff --git a/monitoring/alarms/tables.py b/monitoring/alarms/tables.py index 7695f4c5..aa172030 100644 --- a/monitoring/alarms/tables.py +++ b/monitoring/alarms/tables.py @@ -142,9 +142,13 @@ class GraphMetric(tables.LinkAction): def get_link_url(self, datum): name = datum['metrics'][0]['name'] threshold = datum['metrics'] + token = self.table.request.user.token.id + endpoint = api.monitor.monasca_endpoint(self.table.request) self.attrs['target'] = '_blank' - return "/static/grafana/index.html#/dashboard/script/detail.js?token=%s&name=%s&threshold=%s" % \ - (self.table.request.user.token.id, name, threshold) + url = '/static/grafana/index.html#/dashboard/script/detail.js' + query = "?token=%s&name=%s&threshold=%s&api=%s" % \ + (token, name, threshold, endpoint) + return url + query def allowed(self, request, datum=None): return datum['metrics'] diff --git a/monitoring/api/monitor.py b/monitoring/api/monitor.py index e4186051..b0e44ff8 100644 --- a/monitoring/api/monitor.py +++ b/monitoring/api/monitor.py @@ -29,14 +29,19 @@ def format_parameters(params): return parameters -def monascaclient(request, password=None): - api_version = "2_0" - insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) - cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None) +def monasca_endpoint(request): service_type = getattr(settings, 'MONITORING_SERVICE_TYPE', 'monitoring') endpoint = base.url_for(request, service_type) if endpoint.endswith('/'): endpoint = endpoint[:-1] + return endpoint + + +def monascaclient(request, password=None): + api_version = "2_0" + insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) + cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None) + endpoint = monasca_endpoint(request) LOG.debug('monascaclient connection created using token "%s" , url "%s"' % (request.user.token.id, endpoint)) kwargs = { diff --git a/monitoring/overview/templates/overview/index.html b/monitoring/overview/templates/overview/index.html index 135c36c1..7f0edea8 100644 --- a/monitoring/overview/templates/overview/index.html +++ b/monitoring/overview/templates/overview/index.html @@ -9,7 +9,7 @@ {% block main %}