]>
git.proxmox.com Git - proxmox-backup.git/blob - www/ServerStatus.js
1 Ext
.define('pve-rrd-node', {
2 extend
: 'Ext.data.Model',
7 convert: function(value
) {
14 convert: function(value
) {
32 name
: 'io_delay', calculate: function(data
) {
34 if (data
.read_ios
!== undefined) { ios
+= data
.read_ios
; }
35 if (data
.write_ios
!== undefined) { ios
+= data
.write_ios
; }
36 if (ios
=== 0 || data
.io_ticks
=== undefined) {
39 return (data
.io_ticks
*1000.0)/ios
;
43 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' },
46 Ext
.define('PBS.ServerStatus', {
47 extend
: 'Ext.panel.Panel',
48 alias
: 'widget.pbsServerStatus',
50 title
: gettext('Server Status'),
54 showVersions: function() {
57 // Note: use simply text/html here, as ExtJS grid has problems with cut&paste
58 let panel
= Ext
.createWidget('component', {
64 'font-family': 'monospace',
68 let win
= Ext
.create('Ext.window.Window', {
69 title
: gettext('Package versions'),
78 iconCls
: 'fa fa-clipboard',
79 handler: function(button
) {
80 window
.getSelection().selectAllChildren(
81 document
.getElementById('pkgversions'),
83 document
.execCommand("copy");
85 text
: gettext('Copy'),
90 this.up('window').close();
96 Proxmox
.Utils
.API2Request({
98 url
: `/nodes/localhost/apt/versions`,
100 failure: function(response
, opts
) {
102 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
104 success: function(response
, opts
) {
106 Ext
.Array
.each(response
.result
.data
, function(rec
) {
107 let version
= "not correctly installed";
108 let pkg
= rec
.Package
;
109 if (rec
.OldVersion
&& rec
.OldVersion
!== 'unknown') {
110 version
= rec
.OldVersion
;
113 text
+= `${pkg}: ${version} (${rec.ExtraInfo})\n`;
115 text
+= `${pkg}: ${version}\n`;
120 panel
.update(Ext
.htmlEncode(text
));
125 initComponent: function() {
128 var node_command = function(cmd
) {
129 Proxmox
.Utils
.API2Request({
130 params
: { command
: cmd
},
131 url
: '/nodes/localhost/status',
134 failure: function(response
, opts
) {
135 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
140 var restartBtn
= Ext
.create('Proxmox.button.Button', {
141 text
: gettext('Reboot'),
143 confirmMsg
: gettext("Reboot backup server?"),
144 handler: function() {
145 node_command('reboot');
147 iconCls
: 'fa fa-undo',
150 var shutdownBtn
= Ext
.create('Proxmox.button.Button', {
151 text
: gettext('Shutdown'),
153 confirmMsg
: gettext("Shutdown backup server?"),
154 handler: function() {
155 node_command('shutdown');
157 iconCls
: 'fa fa-power-off',
160 var consoleBtn
= Ext
.create('Proxmox.button.Button', {
161 text
: gettext('Console'),
162 iconCls
: 'fa fa-terminal',
163 handler: function() {
164 Proxmox
.Utils
.openXtermJsViewer('shell', 0, Proxmox
.NodeName
);
168 let version_btn
= new Ext
.Button({
169 text
: gettext('Package versions'),
170 iconCls
: 'fa fa-gift',
171 handler: function() {
172 Proxmox
.Utils
.checked_command(function() { me
.showVersions(); });
176 me
.tbar
= [version_btn
, '-', consoleBtn
, '-', restartBtn
, shutdownBtn
, '->', { xtype
: 'proxmoxRRDTypeSelector' }];
178 var rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
179 rrdurl
: "/api2/json/nodes/localhost/rrd",
180 model
: 'pve-rrd-node',
185 itemId
: 'itemcontainer',
189 resize: function(panel
) {
190 Proxmox
.Utils
.updateColumns(panel
);
200 xtype
: 'proxmoxRRDChart',
201 title
: gettext('CPU usage'),
202 fields
: ['cpu', 'iowait'],
203 fieldTitles
: [gettext('CPU usage'), gettext('IO wait')],
207 xtype
: 'proxmoxRRDChart',
208 title
: gettext('Server load'),
210 fieldTitles
: [gettext('Load average')],
214 xtype
: 'proxmoxRRDChart',
215 title
: gettext('Memory usage'),
216 fields
: ['memtotal', 'memused'],
217 fieldTitles
: [gettext('Total'), gettext('RAM usage')],
223 xtype
: 'proxmoxRRDChart',
224 title
: gettext('Swap usage'),
225 fields
: ['swaptotal', 'swapused'],
226 fieldTitles
: [gettext('Total'), gettext('Swap usage')],
232 xtype
: 'proxmoxRRDChart',
233 title
: gettext('Network traffic'),
234 fields
: ['netin', 'netout'],
238 xtype
: 'proxmoxRRDChart',
239 title
: gettext('Root Disk usage'),
240 fields
: ['total', 'used'],
241 fieldTitles
: [gettext('Total'), gettext('Disk usage')],
245 xtype
: 'proxmoxRRDChart',
246 title
: gettext('Root Disk Transfer Rate (bytes/second)'),
247 fields
: ['read_bytes', 'write_bytes'],
248 fieldTitles
: [gettext('Read'), gettext('Write')],
252 xtype
: 'proxmoxRRDChart',
253 title
: gettext('Root Disk Input/Output Operations per Second (IOPS)'),
254 fields
: ['read_ios', 'write_ios'],
255 fieldTitles
: [gettext('Read'), gettext('Write')],
259 xtype
: 'proxmoxRRDChart',
260 title
: gettext('Root Disk IO Delay (ms)'),
261 fields
: ['io_delay'],
262 fieldTitles
: [gettext('IO Delay')],
269 activate: function() {
270 rrdstore
.startUpdate();
272 destroy: function() {
273 rrdstore
.stopUpdate();
279 let sp
= Ext
.state
.Manager
.getProvider();
280 me
.mon(sp
, 'statechange', function(provider
, key
, value
) {
281 if (key
!== 'summarycolumns') {
284 Proxmox
.Utils
.updateColumns(me
.getComponent('itemcontainer'));