This topic describes the monitoring metric Tenant CPU cost within an OceanBase Database tenant. You can specify a statistical period to query the Tenant CPU cost in a single zone or on a single OBServer of an OceanBase Database tenant.
Definition
The CPU utilization of an OceanBase Database tenant in the specified statistical period.
Description
| Metric | Metric field name | Unit |
|---|---|---|
| Tenant CPU cost | ob_tenant_cpu_percent | % |
Calculation expression
sum(rate(ob_sysstat{stat_id="140013",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(ob_sysstat{stat_id="140005",@LABELS}) by (@GBLABELS) / 100
SQL statements for metric collection
If you use OceanBase Database of a version earlier than V4.0, execute the following statement:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (10000, 10001, 10002, 10003, 10004, 10005, 10006, 20000, 20001, 20002, 30000, 30001, 30002, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30080, 30081, 30082, 30083, 30084, 30085, 30086, 30200, 30201, 30204, 30205, 30208, 30209, 30212, 30213, 30216, 30217, 30220, 30221, 30222, 40000, 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 40018, 40019, 40030, 40116, 40117, 40118, 50000, 50001, 50002, 50004, 50005, 50008, 50009, 50010, 50011, 50037, 50038, 60000, 60001, 60002, 60003, 60004, 60005, 60019, 60020, 60021, 60022, 60023, 60024, 60087, 80001, 80002, 80003, 80007, 80008, 80009, 80040, 80041, 80057, 120000, 120001, 120008, 120009, 130000, 130001, 130002, 130004, 140002, 140003, 140005, 140006, 140012, 140013, 190001, 190002, 190003, 190004, 190005, 190101, 190102, 190103, 190104, 190105, 190201, 190202, 190203, 190204, 190205, 190301, 190302, 190303, 190304, 190305, 190401, 190402, 190403, 190404, 190405, 190501, 190502, 190503, 190504, 190505, 190601, 190602, 190603, 190701, 190702, 190707, 190801, 190901, 190902, 190903, 190904, 190905, 190906, 191001, 191002, 191003, 191004, 191005, 191006, 191007, 191008, 191009, 191010, 191011, 191012, 191013, 191014, 191015, 191016, 191017, 191018, 191019, 191020, 191021, 191022, 191023, 191024, 191101, 191102, 191103, 191104, 191105, 191201, 191202, 191203, 191204, 191205, 191301, 191302, 191303, 191304, 191305, 200000, 200001, 200002, 200005, 200006, 200010, 200013) and (con_id > 1000 or con_id = 1)If you use OceanBase Database V4.0 or later, execute the following statement:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (10000, 10001, 10002, 10003, 10004, 10005, 10006, 20000, 20001, 20002, 30000, 30001, 30002, 30005, 30006, 30007, 30008, 30009, 30010, 30011, 30012, 30013, 30080, 30081, 30082, 30083, 30084, 30085, 30086, 30200, 30201, 30204, 30205, 30208, 30209, 30212, 30213, 30216, 30217, 30220, 30221, 30222, 40000, 40001, 40002, 40003, 40004, 40005, 40006, 40007, 40008, 40009, 40010, 40011, 40012, 40018, 40019, 40025, 40026, 40027, 40028, 40030, 40116, 40117, 40118, 50000, 50001, 50002, 50004, 50005, 50008, 50009, 50010, 50011, 50037, 50038, 60000, 60001, 60002, 60003, 60004, 60005, 60019, 60020, 60021, 60022, 60023, 60024, 60087, 80001, 80002, 80003, 80007, 80008, 80009, 80040, 80041, 80057, 120000, 120001, 120008, 120009, 130000, 130001, 130002, 130004, 140002, 140003, 140005, 140006, 140012, 140013, 190001, 190002, 190003, 190004, 190005, 190101, 190102, 190103, 190104, 190105, 190201, 190202, 190203, 190204, 190205, 190301, 190302, 190303, 190304, 190305, 190401, 190402, 190403, 190404, 190405, 190501, 190502, 190503, 190504, 190505, 190601, 190602, 190603, 190701, 190702, 190707, 190801, 190901, 190902, 190903, 190904, 190905, 190906, 191001, 191002, 191003, 191004, 191005, 191006, 191007, 191008, 191009, 191010, 191011, 191012, 191013, 191014, 191015, 191016, 191017, 191018, 191019, 191020, 191021, 191022, 191023, 191024, 191101, 191102, 191103, 191104, 191105, 191201, 191202, 191203, 191204, 191205, 191301, 191302, 191303, 191304, 191305, 191643, 191644, 191631, 191632, 191589, 191590, 191595, 191596, 191509, 191510, 191517, 191518, 191541, 191542, 191557, 191558, 200001, 200002, 200005, 200006, 200010, 200013) and (con_id > 1000 or con_id = 1)