]>
git.proxmox.com Git - pmg-gui.git/blob - js/ServerStatus.js
2 Ext
.define('PMG.ServerStatus', {
3 extend
: 'Ext.panel.Panel',
4 alias
: 'widget.pmgServerStatus',
6 title
: gettext('Status'),
12 bodyPadding
: '10 0 0 0',
21 xclass
: 'Ext.app.ViewController',
23 openConsole: function() {
24 Proxmox
.Utils
.openXtermJsViewer('shell', 0, Proxmox
.NodeName
);
27 nodeCommand: function(cmd
) {
28 var me
= this.getView();
29 Proxmox
.Utils
.API2Request({
30 params
: { command
: cmd
},
31 url
: '/nodes/' + Proxmox
.NodeName
+ '/status',
34 failure: function(response
, opts
) {
35 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
40 nodeShutdown: function() {
41 this.nodeCommand('shutdown');
44 nodeReboot: function() {
45 this.nodeCommand('reboot');
51 text
: gettext("Console"),
52 iconCls
: 'fa fa-terminal',
53 handler
: 'openConsole'
56 xtype
: 'proxmoxButton',
57 text
: gettext('Restart'),
59 confirmMsg
: gettext('Node') + " '" + Proxmox
.NodeName
+ "' - " + gettext('Restart'),
60 handler
: 'nodeReboot',
64 xtype
: 'proxmoxButton',
65 text
: gettext('Shutdown'),
67 confirmMsg
: gettext('Node') + " '" + Proxmox
.NodeName
+ "' - " + gettext('Shutdown'),
68 handler
: 'nodeShutdown',
69 iconCls
: 'fa fa-power-off'
73 xtype
: 'proxmoxRRDTypeSelector'
77 initComponent: function() {
80 var nodename
= Proxmox
.NodeName
;
81 var rrdstore
= Ext
.create('Proxmox.data.RRDStore', {
82 rrdurl
: "/api2/json/nodes/" + nodename
+ "/rrddata",
84 { type
: 'number', name
: 'loadavg' },
85 { type
: 'number', name
: 'maxcpu' },
89 convert: function(val
) {
96 convert: function(val
) {
100 { type
: 'number', name
: 'memtotal' },
101 { type
: 'number', name
: 'memused' },
102 { type
: 'number', name
: 'swaptotal' },
103 { type
: 'number', name
: 'swapused' },
104 { type
: 'number', name
: 'roottotal' },
105 { type
: 'number', name
: 'rootused' },
106 { type
: 'number', name
: 'netin' },
107 { type
: 'number', name
: 'netout' },
108 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' }
115 xtype
: 'proxmoxRRDChart',
116 title
: gettext('CPU usage'),
118 fields
: ['cpu','iowait'],
119 fieldTitles
: [gettext('CPU usage'), gettext('IO delay')],
123 xtype
: 'proxmoxRRDChart',
124 title
: gettext('Server load'),
126 fieldTitles
: [gettext('Load average')],
130 xtype
: 'proxmoxRRDChart',
131 title
: gettext('Memory usage'),
133 fields
: ['memtotal','memused'],
134 fieldTitles
: [gettext('Total'), gettext('Used')],
138 xtype
: 'proxmoxRRDChart',
139 title
: gettext('Swap usage'),
141 fields
: ['swaptotal','swapused'],
142 fieldTitles
: [gettext('Total'), gettext('Used')],
146 xtype
: 'proxmoxRRDChart',
147 title
: gettext('Network traffic'),
148 unit
: 'bytespersecond',
149 fields
: ['netin','netout'],
150 fieldTitles
: [gettext('Ingress'), gettext('Egress')],
154 xtype
: 'proxmoxRRDChart',
155 title
: gettext('Disk usage'),
157 fields
: ['roottotal','rootused'],
158 fieldTitles
: [gettext('Total'), gettext('Used')],
163 activate: function() {
164 rrdstore
.startUpdate();
166 destroy: function() {
167 rrdstore
.stopUpdate();