]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/controllers/telemetry.py
import 15.2.4
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / telemetry.py
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3
4 from . import ApiController, RESTController
5 from .. import mgr
6 from ..exceptions import DashboardException
7 from ..security import Scope
8
9
10 @ApiController('/telemetry', Scope.CONFIG_OPT)
11 class Telemetry(RESTController):
12
13 @RESTController.Collection('GET')
14 def report(self):
15 """
16 Get Ceph and device report data
17 :return: Ceph and device report data
18 :rtype: dict
19 """
20 return mgr.remote('telemetry', 'get_report', 'all')
21
22 def singleton_set(self, enable=True, license_name=None):
23 """
24 Enables or disables sending data collected by the Telemetry
25 module.
26 :param enable: Enable or disable sending data
27 :type enable: bool
28 :param license_name: License string e.g. 'sharing-1-0' to
29 make sure the user is aware of and accepts the license
30 for sharing Telemetry data.
31 :type license_name: string
32 """
33 if enable:
34 if not license_name or (license_name != 'sharing-1-0'):
35 raise DashboardException(
36 code='telemetry_enable_license_missing',
37 msg='Telemetry data is licensed under the Community Data License Agreement - '
38 'Sharing - Version 1.0 (https://cdla.io/sharing-1-0/). To enable, add '
39 '{"license": "sharing-1-0"} to the request payload.'
40 )
41 mgr.remote('telemetry', 'on')
42 else:
43 mgr.remote('telemetry', 'off')