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