]> git.proxmox.com Git - ceph.git/blame - 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
11fdf7f2
TL
1# -*- coding: utf-8 -*-
2from __future__ import absolute_import
3
4import cherrypy
5
11fdf7f2
TL
6from .. import mgr
7from ..security import Scope
8from ..services.ceph_service import CephService
a4b75251 9from . import APIDoc, APIRouter, EndpointDoc, RESTController
f67539c2
TL
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}
11fdf7f2
TL
23
24
25class PerfCounter(RESTController):
26 service_type = None # type: str
27
28 def get(self, service_id):
11fdf7f2 29 try:
522d829b
TL
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))
11fdf7f2
TL
33
34
a4b75251
TL
35@APIRouter('perf_counters/mds', Scope.CEPHFS)
36@APIDoc("Mds Perf Counters Management API", "MdsPerfCounter")
11fdf7f2
TL
37class MdsPerfCounter(PerfCounter):
38 service_type = 'mds'
39
40
a4b75251
TL
41@APIRouter('perf_counters/mon', Scope.MONITOR)
42@APIDoc("Mon Perf Counters Management API", "MonPerfCounter")
11fdf7f2
TL
43class MonPerfCounter(PerfCounter):
44 service_type = 'mon'
45
46
a4b75251
TL
47@APIRouter('perf_counters/osd', Scope.OSD)
48@APIDoc("OSD Perf Counters Management API", "OsdPerfCounter")
11fdf7f2
TL
49class OsdPerfCounter(PerfCounter):
50 service_type = 'osd'
51
52
a4b75251
TL
53@APIRouter('perf_counters/rgw', Scope.RGW)
54@APIDoc("Rgw Perf Counters Management API", "RgwPerfCounter")
11fdf7f2
TL
55class RgwPerfCounter(PerfCounter):
56 service_type = 'rgw'
57
58
a4b75251
TL
59@APIRouter('perf_counters/rbd-mirror', Scope.RBD_MIRRORING)
60@APIDoc("Rgw Mirroring Perf Counters Management API", "RgwMirrorPerfCounter")
11fdf7f2
TL
61class RbdMirrorPerfCounter(PerfCounter):
62 service_type = 'rbd-mirror'
63
64
a4b75251
TL
65@APIRouter('perf_counters/mgr', Scope.MANAGER)
66@APIDoc("Mgr Perf Counters Management API", "MgrPerfCounter")
11fdf7f2
TL
67class MgrPerfCounter(PerfCounter):
68 service_type = 'mgr'
69
70
a4b75251
TL
71@APIRouter('perf_counters/tcmu-runner', Scope.ISCSI)
72@APIDoc("Tcmu Runner Perf Counters Management API", "TcmuRunnerPerfCounter")
81eedcae
TL
73class TcmuRunnerPerfCounter(PerfCounter):
74 service_type = 'tcmu-runner'
75
76
a4b75251
TL
77@APIRouter('perf_counters')
78@APIDoc("Perf Counters Management API", "PerfCounters")
11fdf7f2 79class PerfCounters(RESTController):
f67539c2
TL
80 @EndpointDoc("Display Perf Counters",
81 responses={200: PERF_SCHEMA})
11fdf7f2
TL
82 def list(self):
83 return mgr.get_all_perf_counters()