]> git.proxmox.com Git - proxmox-backup.git/blame - www/ServerStatus.js
src/tools/disks/zfs.rs: use wtime + rtime (wait + run time)
[proxmox-backup.git] / www / ServerStatus.js
CommitLineData
880fa939
DM
1Ext.define('pve-rrd-node', {
2 extend: 'Ext.data.Model',
3 fields: [
4 {
5 name: 'cpu',
6 // percentage
7 convert: function(value) {
8 return value*100;
9 }
10 },
11 {
12 name: 'iowait',
13 // percentage
14 convert: function(value) {
15 return value*100;
16 }
17 },
18 'netin',
19 'netout',
20 'memtotal',
21 'memused',
22 'swaptotal',
23 'swapused',
24 'roottotal',
25 'rootused',
26 'loadavg',
27 { type: 'date', dateFormat: 'timestamp', name: 'time' }
28 ]
29});
ecb53af6
DM
30Ext.define('PBS.ServerStatus', {
31 extend: 'Ext.panel.Panel',
32 alias: 'widget.pbsServerStatus',
33
34 title: gettext('ServerStatus'),
35
880fa939 36 scrollable: true,
ecb53af6
DM
37
38 initComponent: function() {
39 var me = this;
40
41 var node_command = function(cmd) {
42 Proxmox.Utils.API2Request({
43 params: { command: cmd },
44 url: '/nodes/localhost/status',
45 method: 'POST',
46 waitMsgTarget: me,
47 failure: function(response, opts) {
48 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
49 }
50 });
51 };
52
53 var restartBtn = Ext.create('Proxmox.button.Button', {
54 text: gettext('Reboot'),
55 dangerous: true,
56 confirmMsg: gettext("Reboot backup server?"),
57 handler: function() {
58 node_command('reboot');
59 },
60 iconCls: 'fa fa-undo'
61 });
62
63 var shutdownBtn = Ext.create('Proxmox.button.Button', {
64 text: gettext('Shutdown'),
65 dangerous: true,
66 confirmMsg: gettext("Shutdown backup server?"),
67 handler: function() {
68 node_command('shutdown');
69 },
70 iconCls: 'fa fa-power-off'
71 });
72
880fa939
DM
73 me.tbar = [ restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' } ];
74
75 var rrdstore = Ext.create('Proxmox.data.RRDStore', {
76 rrdurl: "/api2/json/nodes/localhost/rrd",
77 model: 'pve-rrd-node'
78 });
79
80 me.items = {
81 xtype: 'container',
82 itemId: 'itemcontainer',
83 layout: 'column',
84 minWidth: 700,
85 defaults: {
86 minHeight: 320,
87 padding: 5,
88 columnWidth: 1
89 },
90 items: [
91 {
92 xtype: 'proxmoxRRDChart',
93 title: gettext('CPU usage'),
94 fields: ['cpu','iowait'],
95 fieldTitles: [gettext('CPU usage'), gettext('IO delay')],
96 store: rrdstore
97 },
98 {
99 xtype: 'proxmoxRRDChart',
100 title: gettext('Server load'),
101 fields: ['loadavg'],
102 fieldTitles: [gettext('Load average')],
103 store: rrdstore
104 },
105 {
106 xtype: 'proxmoxRRDChart',
107 title: gettext('Memory usage'),
108 fields: ['memtotal','memused'],
109 fieldTitles: [gettext('Total'), gettext('RAM usage')],
110 store: rrdstore
111 },
112 {
113 xtype: 'proxmoxRRDChart',
114 title: gettext('Swap usage'),
115 fields: ['swaptotal','swapused'],
116 fieldTitles: [gettext('Total'), gettext('Swap usage')],
117 store: rrdstore
118 },
119 {
120 xtype: 'proxmoxRRDChart',
121 title: gettext('Network traffic'),
122 fields: ['netin','netout'],
123 store: rrdstore
124 },
125 {
126 xtype: 'proxmoxRRDChart',
127 title: gettext('Root Disk usage'),
128 fields: ['roottotal','rootused'],
129 fieldTitles: [gettext('Total'), gettext('Disk usage')],
130 store: rrdstore
131 },
132 ]
133 };
134
135 me.listeners = {
136 activate: function() {
137 rrdstore.startUpdate();
138 },
139 destroy: function() {
140 rrdstore.stopUpdate();
141 },
142 };
ecb53af6
DM
143
144 me.callParent();
145 }
146
147});