]>
git.proxmox.com Git - pmg-gui.git/blob - js/ServerStatus.js
1 Ext
.define('PMG.ServerStatus', {
2 extend
: 'Ext.panel.Panel',
3 alias
: 'widget.pmgServerStatus',
5 title
: gettext('Status'),
11 bodyPadding
: '10 0 0 0',
20 xclass
: 'Ext.app.ViewController',
22 openConsole: function() {
23 Proxmox
.Utils
.openXtermJsViewer('shell', 0, Proxmox
.NodeName
);
26 nodeCommand: function(cmd
) {
27 var view
= this.getView();
28 Proxmox
.Utils
.API2Request({
29 params
: { command
: cmd
},
30 url
: `/nodes/${Proxmox.NodeName}/status`,
33 failure: function(response
, opts
) {
34 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
39 nodeShutdown: function() {
40 this.nodeCommand('shutdown');
43 nodeReboot: function() {
44 this.nodeCommand('reboot');
50 text
: gettext("Console"),
51 iconCls
: 'fa fa-terminal',
52 handler
: 'openConsole',
55 xtype
: 'proxmoxButton',
56 text
: gettext('Restart'),
58 confirmMsg
: gettext('Node') + " '" + Proxmox
.NodeName
+ "' - " + gettext('Restart'),
59 handler
: 'nodeReboot',
60 iconCls
: 'fa fa-undo',
63 xtype
: 'proxmoxButton',
64 text
: gettext('Shutdown'),
66 confirmMsg
: gettext('Node') + " '" + Proxmox
.NodeName
+ "' - " + gettext('Shutdown'),
67 handler
: 'nodeShutdown',
68 iconCls
: 'fa fa-power-off',
72 xtype
: 'proxmoxRRDTypeSelector',
76 initComponent: function() {
79 var nodename
= Proxmox
.NodeName
;
80 var rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
81 rrdurl
: "/api2/json/nodes/" + nodename
+ "/rrddata",
83 { type
: 'number', name
: 'loadavg' },
84 { type
: 'number', name
: 'maxcpu' },
88 convert: function(val
) {
95 convert: function(val
) {
99 { type
: 'number', name
: 'memtotal' },
100 { type
: 'number', name
: 'memused' },
101 { type
: 'number', name
: 'swaptotal' },
102 { type
: 'number', name
: 'swapused' },
103 { type
: 'number', name
: 'roottotal' },
104 { type
: 'number', name
: 'rootused' },
105 { type
: 'number', name
: 'netin' },
106 { type
: 'number', name
: 'netout' },
107 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' },
114 xtype
: 'proxmoxRRDChart',
115 title
: gettext('CPU usage'),
117 fields
: ['cpu', 'iowait'],
118 fieldTitles
: [gettext('CPU usage'), gettext('IO delay')],
122 xtype
: 'proxmoxRRDChart',
123 title
: gettext('Server load'),
125 fieldTitles
: [gettext('Load average')],
129 xtype
: 'proxmoxRRDChart',
130 title
: gettext('Memory usage'),
132 fields
: ['memtotal', 'memused'],
133 fieldTitles
: [gettext('Total'), gettext('Used')],
137 xtype
: 'proxmoxRRDChart',
138 title
: gettext('Swap usage'),
140 fields
: ['swaptotal', 'swapused'],
141 fieldTitles
: [gettext('Total'), gettext('Used')],
145 xtype
: 'proxmoxRRDChart',
146 title
: gettext('Network traffic'),
147 unit
: 'bytespersecond',
148 fields
: ['netin', 'netout'],
149 fieldTitles
: [gettext('Ingress'), gettext('Egress')],
153 xtype
: 'proxmoxRRDChart',
154 title
: gettext('Disk usage'),
156 fields
: ['roottotal', 'rootused'],
157 fieldTitles
: [gettext('Total'), gettext('Used')],
162 activate: function() {
163 rrdstore
.startUpdate();
165 destroy: function() {
166 rrdstore
.stopUpdate();