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