]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/controllers/grafana.py
0d4331ff246372348aafc8378db7b019062dd42c
1 # -*- coding: utf-8 -*-
2 from __future__
import absolute_import
4 from . import (ApiController
, BaseController
, Endpoint
, ReadPermission
,
6 from ..exceptions
import DashboardException
7 from ..grafana
import GrafanaRestClient
, push_local_dashboards
8 from ..security
import Scope
9 from ..settings
import Settings
12 @ApiController('/grafana', Scope
.GRAFANA
)
13 class Grafana(BaseController
):
18 response
= {'instance': Settings
.GRAFANA_API_URL
}
23 def validation(self
, params
):
24 grafana
= GrafanaRestClient()
26 url
= Settings
.GRAFANA_API_URL
.rstrip('/') + \
27 '/api/dashboards/uid/' + params
28 response
= grafana
.url_validation(method
, url
)
31 @Endpoint(method
='POST')
36 response
['success'] = push_local_dashboards()
37 except Exception as e
: # pylint: disable=broad-except
38 raise DashboardException(