]> git.proxmox.com Git - ceph.git/blame_incremental - ceph/src/pybind/mgr/dashboard/controllers/perf_counters.py
import ceph 16.2.7
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / perf_counters.py
... / ...
CommitLineData
1# -*- coding: utf-8 -*-
2from __future__ import absolute_import
3
4import cherrypy
5
6from .. import mgr
7from ..security import Scope
8from ..services.ceph_service import CephService
9from . import APIDoc, APIRouter, EndpointDoc, RESTController
10
11PERF_SCHEMA = {
12 "mon.a": ({
13 ".cache_bytes": ({
14 "description": (str, ""),
15 "nick": (str, ""),
16 "type": (int, ""),
17 "priority": (int, ""),
18 "units": (int, ""),
19 "value": (int, "")
20 }, ""),
21 }, "Service ID"),
22}
23
24
25class PerfCounter(RESTController):
26 service_type = None # type: str
27
28 def get(self, service_id):
29 try:
30 return CephService.get_service_perf_counters(self.service_type, str(service_id))
31 except KeyError as error:
32 raise cherrypy.HTTPError(404, "{0} not found".format(error))
33
34
35@APIRouter('perf_counters/mds', Scope.CEPHFS)
36@APIDoc("Mds Perf Counters Management API", "MdsPerfCounter")
37class MdsPerfCounter(PerfCounter):
38 service_type = 'mds'
39
40
41@APIRouter('perf_counters/mon', Scope.MONITOR)
42@APIDoc("Mon Perf Counters Management API", "MonPerfCounter")
43class MonPerfCounter(PerfCounter):
44 service_type = 'mon'
45
46
47@APIRouter('perf_counters/osd', Scope.OSD)
48@APIDoc("OSD Perf Counters Management API", "OsdPerfCounter")
49class OsdPerfCounter(PerfCounter):
50 service_type = 'osd'
51
52
53@APIRouter('perf_counters/rgw', Scope.RGW)
54@APIDoc("Rgw Perf Counters Management API", "RgwPerfCounter")
55class RgwPerfCounter(PerfCounter):
56 service_type = 'rgw'
57
58
59@APIRouter('perf_counters/rbd-mirror', Scope.RBD_MIRRORING)
60@APIDoc("Rgw Mirroring Perf Counters Management API", "RgwMirrorPerfCounter")
61class RbdMirrorPerfCounter(PerfCounter):
62 service_type = 'rbd-mirror'
63
64
65@APIRouter('perf_counters/mgr', Scope.MANAGER)
66@APIDoc("Mgr Perf Counters Management API", "MgrPerfCounter")
67class MgrPerfCounter(PerfCounter):
68 service_type = 'mgr'
69
70
71@APIRouter('perf_counters/tcmu-runner', Scope.ISCSI)
72@APIDoc("Tcmu Runner Perf Counters Management API", "TcmuRunnerPerfCounter")
73class TcmuRunnerPerfCounter(PerfCounter):
74 service_type = 'tcmu-runner'
75
76
77@APIRouter('perf_counters')
78@APIDoc("Perf Counters Management API", "PerfCounters")
79class PerfCounters(RESTController):
80 @EndpointDoc("Display Perf Counters",
81 responses={200: PERF_SCHEMA})
82 def list(self):
83 return mgr.get_all_perf_counters()