2020-05-26 05:32:05 +00:00
|
|
|
Ext.define('pve-rrd-node', {
|
|
|
|
extend: 'Ext.data.Model',
|
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: 'cpu',
|
|
|
|
// percentage
|
|
|
|
convert: function(value) {
|
|
|
|
return value*100;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'iowait',
|
|
|
|
// percentage
|
|
|
|
convert: function(value) {
|
|
|
|
return value*100;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'netin',
|
|
|
|
'netout',
|
|
|
|
'memtotal',
|
|
|
|
'memused',
|
|
|
|
'swaptotal',
|
|
|
|
'swapused',
|
2020-05-28 17:11:37 +00:00
|
|
|
'total',
|
|
|
|
'used',
|
|
|
|
'read_ios',
|
|
|
|
'read_bytes',
|
|
|
|
'write_ios',
|
|
|
|
'write_bytes',
|
|
|
|
'io_ticks',
|
|
|
|
{
|
|
|
|
name: 'io_delay', calculate: function(data) {
|
|
|
|
let ios = 0;
|
|
|
|
if (data.read_ios !== undefined) { ios += data.read_ios; }
|
|
|
|
if (data.write_ios !== undefined) { ios += data.write_ios; }
|
|
|
|
if (ios == 0 || data.io_ticks === undefined) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
return (data.io_ticks*1000.0)/ios;
|
|
|
|
}
|
|
|
|
},
|
2020-05-26 05:32:05 +00:00
|
|
|
'loadavg',
|
|
|
|
{ type: 'date', dateFormat: 'timestamp', name: 'time' }
|
|
|
|
]
|
|
|
|
});
|
2020-04-30 10:11:08 +00:00
|
|
|
Ext.define('PBS.ServerStatus', {
|
|
|
|
extend: 'Ext.panel.Panel',
|
|
|
|
alias: 'widget.pbsServerStatus',
|
|
|
|
|
|
|
|
title: gettext('ServerStatus'),
|
|
|
|
|
2020-05-26 05:32:05 +00:00
|
|
|
scrollable: true,
|
2020-04-30 10:11:08 +00:00
|
|
|
|
|
|
|
initComponent: function() {
|
|
|
|
var me = this;
|
|
|
|
|
|
|
|
var node_command = function(cmd) {
|
|
|
|
Proxmox.Utils.API2Request({
|
|
|
|
params: { command: cmd },
|
|
|
|
url: '/nodes/localhost/status',
|
|
|
|
method: 'POST',
|
|
|
|
waitMsgTarget: me,
|
|
|
|
failure: function(response, opts) {
|
|
|
|
Ext.Msg.alert(gettext('Error'), response.htmlStatus);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var restartBtn = Ext.create('Proxmox.button.Button', {
|
|
|
|
text: gettext('Reboot'),
|
|
|
|
dangerous: true,
|
|
|
|
confirmMsg: gettext("Reboot backup server?"),
|
|
|
|
handler: function() {
|
|
|
|
node_command('reboot');
|
|
|
|
},
|
|
|
|
iconCls: 'fa fa-undo'
|
|
|
|
});
|
|
|
|
|
|
|
|
var shutdownBtn = Ext.create('Proxmox.button.Button', {
|
|
|
|
text: gettext('Shutdown'),
|
|
|
|
dangerous: true,
|
|
|
|
confirmMsg: gettext("Shutdown backup server?"),
|
|
|
|
handler: function() {
|
|
|
|
node_command('shutdown');
|
|
|
|
},
|
|
|
|
iconCls: 'fa fa-power-off'
|
|
|
|
});
|
|
|
|
|
2020-07-21 09:10:40 +00:00
|
|
|
var consoleBtn = Ext.create('Proxmox.button.Button', {
|
|
|
|
text: gettext('Console'),
|
|
|
|
iconCls: 'fa fa-terminal',
|
|
|
|
handler: function() {
|
|
|
|
Proxmox.Utils.openXtermJsViewer('shell', 0, Proxmox.NodeName);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
me.tbar = [ consoleBtn, restartBtn, shutdownBtn, '->', { xtype: 'proxmoxRRDTypeSelector' } ];
|
2020-05-26 05:32:05 +00:00
|
|
|
|
|
|
|
var rrdstore = Ext.create('Proxmox.data.RRDStore', {
|
|
|
|
rrdurl: "/api2/json/nodes/localhost/rrd",
|
|
|
|
model: 'pve-rrd-node'
|
|
|
|
});
|
|
|
|
|
|
|
|
me.items = {
|
|
|
|
xtype: 'container',
|
|
|
|
itemId: 'itemcontainer',
|
|
|
|
layout: 'column',
|
|
|
|
minWidth: 700,
|
|
|
|
defaults: {
|
|
|
|
minHeight: 320,
|
|
|
|
padding: 5,
|
|
|
|
columnWidth: 1
|
|
|
|
},
|
|
|
|
items: [
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('CPU usage'),
|
|
|
|
fields: ['cpu','iowait'],
|
2020-05-29 04:12:49 +00:00
|
|
|
fieldTitles: [gettext('CPU usage'), gettext('IO wait')],
|
2020-05-26 05:32:05 +00:00
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Server load'),
|
|
|
|
fields: ['loadavg'],
|
|
|
|
fieldTitles: [gettext('Load average')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Memory usage'),
|
|
|
|
fields: ['memtotal','memused'],
|
|
|
|
fieldTitles: [gettext('Total'), gettext('RAM usage')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Swap usage'),
|
|
|
|
fields: ['swaptotal','swapused'],
|
|
|
|
fieldTitles: [gettext('Total'), gettext('Swap usage')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Network traffic'),
|
|
|
|
fields: ['netin','netout'],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Root Disk usage'),
|
2020-05-28 10:30:54 +00:00
|
|
|
fields: ['total','used'],
|
2020-05-26 05:32:05 +00:00
|
|
|
fieldTitles: [gettext('Total'), gettext('Disk usage')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
2020-05-28 10:30:54 +00:00
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Root Disk Transfer Rate (bytes/second)'),
|
|
|
|
fields: ['read_bytes','write_bytes'],
|
|
|
|
fieldTitles: [gettext('Read'), gettext('Write')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Root Disk Input/Output Operations per Second (IOPS)'),
|
|
|
|
fields: ['read_ios','write_ios'],
|
|
|
|
fieldTitles: [gettext('Read'), gettext('Write')],
|
|
|
|
store: rrdstore
|
|
|
|
},
|
|
|
|
{
|
|
|
|
xtype: 'proxmoxRRDChart',
|
|
|
|
title: gettext('Root Disk IO Delay (ms)'),
|
2020-05-28 17:11:37 +00:00
|
|
|
fields: ['io_delay'],
|
|
|
|
fieldTitles: [gettext('IO Delay')],
|
2020-05-28 10:30:54 +00:00
|
|
|
store: rrdstore
|
|
|
|
},
|
2020-05-26 05:32:05 +00:00
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
me.listeners = {
|
|
|
|
activate: function() {
|
|
|
|
rrdstore.startUpdate();
|
|
|
|
},
|
|
|
|
destroy: function() {
|
|
|
|
rrdstore.stopUpdate();
|
|
|
|
},
|
|
|
|
};
|
2020-04-30 10:11:08 +00:00
|
|
|
|
|
|
|
me.callParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|