]> git.proxmox.com Git - proxmox-backup.git/blob - www/DataStoreStatistic.js
c22640e432ceab68665c290c472fb1107d6dcb94
[proxmox-backup.git] / www / DataStoreStatistic.js
1 Ext.define('pve-rrd-datastore', {
2 extend: 'Ext.data.Model',
3 fields: [
4 'used',
5 'total',
6 'read_ios',
7 'read_bytes',
8 'write_ios',
9 'write_bytes',
10 'io_ticks',
11 {
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; }
16 if (data.io_ticks === undefined) {
17 return undefined;
18 } else if (ios === 0) {
19 return 0;
20 }
21 return (data.io_ticks*1000.0)/ios;
22 },
23 },
24 { type: 'date', dateFormat: 'timestamp', name: 'time' },
25 ],
26 });
27
28 Ext.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
43 me.tbar = ['->', { xtype: 'proxmoxRRDTypeSelector' }];
44
45 var rrdstore = Ext.create('Proxmox.data.RRDStore', {
46 rrdurl: "/api2/json/admin/datastore/" + me.datastore + "/rrd",
47 model: 'pve-rrd-datastore',
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,
58 columnWidth: 1,
59 },
60 items: [
61 {
62 xtype: 'proxmoxRRDChart',
63 title: gettext('Storage usage (bytes)'),
64 fields: ['total', 'used'],
65 fieldTitles: [gettext('Total'), gettext('Storage usage')],
66 store: rrdstore,
67 },
68 {
69 xtype: 'proxmoxRRDChart',
70 title: gettext('Transfer Rate (bytes/second)'),
71 fields: ['read_bytes', 'write_bytes'],
72 fieldTitles: [gettext('Read'), gettext('Write')],
73 store: rrdstore,
74 },
75 {
76 xtype: 'proxmoxRRDChart',
77 title: gettext('Input/Output Operations per Second (IOPS)'),
78 fields: ['read_ios', 'write_ios'],
79 fieldTitles: [gettext('Read'), gettext('Write')],
80 store: rrdstore,
81 },
82 {
83 xtype: 'proxmoxRRDChart',
84 title: gettext('IO Delay (ms)'),
85 fields: ['io_delay'],
86 fieldTitles: [gettext('IO Delay')],
87 store: rrdstore,
88 },
89 ],
90 };
91
92 me.listeners = {
93 activate: function() {
94 rrdstore.startUpdate();
95 },
96 destroy: function() {
97 rrdstore.stopUpdate();
98 },
99 };
100
101 me.callParent();
102 },
103
104 });