]> git.proxmox.com Git - proxmox-backup.git/blame - www/DataStoreStatistic.js
api: disks: cleanup use statement
[proxmox-backup.git] / www / DataStoreStatistic.js
CommitLineData
1a0d3d11
DM
1Ext.define('pve-rrd-datastore', {
2 extend: 'Ext.data.Model',
3 fields: [
4 'used',
5 'total',
6 'read_ios',
7 'read_bytes',
1a0d3d11
DM
8 'write_ios',
9 'write_bytes',
c94e1f65 10 'io_ticks',
1a0d3d11 11 {
c94e1f65
DM
12 name: 'io_delay', calculate: function(data) {
13 let ios = 0;
14 if (data.read_ios !== undefined) { ios += data.read_ios; }
15 if (data.write_ios !== undefined) { ios += data.write_ios; }
e3efaa19 16 if (data.io_ticks === undefined) {
1a0d3d11 17 return undefined;
e3efaa19
DC
18 } else if (ios === 0) {
19 return 0;
1a0d3d11 20 }
c94e1f65 21 return (data.io_ticks*1000.0)/ios;
264c1958 22 },
1a0d3d11 23 },
264c1958
TL
24 { type: 'date', dateFormat: 'timestamp', name: 'time' },
25 ],
1a0d3d11
DM
26});
27
28Ext.define('PBS.DataStoreStatistic', {
29 extend: 'Ext.panel.Panel',
30 alias: 'widget.pbsDataStoreStatistic',
31
32 title: gettext('Statistics'),
33
34 scrollable: true,
35
36 initComponent: function() {
37 var me = this;
38
39 if (!me.datastore) {
40 throw "no datastore specified";
41 }
42
264c1958 43 me.tbar = ['->', { xtype: 'proxmoxRRDTypeSelector' }];
1a0d3d11
DM
44
45 var rrdstore = Ext.create('Proxmox.data.RRDStore', {
46 rrdurl: "/api2/json/admin/datastore/" + me.datastore + "/rrd",
264c1958 47 model: 'pve-rrd-datastore',
1a0d3d11
DM
48 });
49
50 me.items = {
51 xtype: 'container',
52 itemId: 'itemcontainer',
53 layout: 'column',
54 minWidth: 700,
55 defaults: {
56 minHeight: 320,
57 padding: 5,
264c1958 58 columnWidth: 1,
1a0d3d11
DM
59 },
60 items: [
61 {
62 xtype: 'proxmoxRRDChart',
4bf26be3 63 title: gettext('Storage usage (bytes)'),
264c1958 64 fields: ['total', 'used'],
1a0d3d11 65 fieldTitles: [gettext('Total'), gettext('Storage usage')],
264c1958 66 store: rrdstore,
1a0d3d11
DM
67 },
68 {
69 xtype: 'proxmoxRRDChart',
4bf26be3 70 title: gettext('Transfer Rate (bytes/second)'),
264c1958 71 fields: ['read_bytes', 'write_bytes'],
4bf26be3 72 fieldTitles: [gettext('Read'), gettext('Write')],
264c1958 73 store: rrdstore,
4bf26be3
DM
74 },
75 {
76 xtype: 'proxmoxRRDChart',
77 title: gettext('Input/Output Operations per Second (IOPS)'),
264c1958 78 fields: ['read_ios', 'write_ios'],
4bf26be3 79 fieldTitles: [gettext('Read'), gettext('Write')],
264c1958 80 store: rrdstore,
1a0d3d11
DM
81 },
82 {
83 xtype: 'proxmoxRRDChart',
c94e1f65
DM
84 title: gettext('IO Delay (ms)'),
85 fields: ['io_delay'],
86 fieldTitles: [gettext('IO Delay')],
264c1958 87 store: rrdstore,
1a0d3d11 88 },
264c1958 89 ],
1a0d3d11
DM
90 };
91
92 me.listeners = {
93 activate: function() {
94 rrdstore.startUpdate();
95 },
96 destroy: function() {
97 rrdstore.stopUpdate();
98 },
99 };
100
101 me.callParent();
264c1958 102 },
1a0d3d11
DM
103
104});