Fix CPU usage display for server
Previously was stacked and would show 2x normal usage.
This commit is contained in:
parent
edf0939ff3
commit
f560020ffd
|
@ -201,7 +201,6 @@ $(window).load(function () {
|
||||||
width: $('#col11_setter').width()
|
width: $('#col11_setter').width()
|
||||||
},
|
},
|
||||||
colors: [
|
colors: [
|
||||||
'#113F8C',
|
|
||||||
'#00A1CB',
|
'#00A1CB',
|
||||||
'#01A4A4',
|
'#01A4A4',
|
||||||
'#61AE24',
|
'#61AE24',
|
||||||
|
@ -223,13 +222,22 @@ $(window).load(function () {
|
||||||
crosshairs: true,
|
crosshairs: true,
|
||||||
formatter: function () {
|
formatter: function () {
|
||||||
var s = '<b>CPU Usage</b>';
|
var s = '<b>CPU Usage</b>';
|
||||||
|
var i = 0;
|
||||||
|
var t = 0;
|
||||||
$.each(this.points, function () {
|
$.each(this.points, function () {
|
||||||
|
t = t + this.y;
|
||||||
|
i++;
|
||||||
s += '<br/>' + this.series.name + ': ' +
|
s += '<br/>' + this.series.name + ': ' +
|
||||||
this.y + '%';
|
this.y + '%';
|
||||||
});
|
});
|
||||||
|
|
||||||
return s;
|
t = parseFloat(t).toFixed(3).toString();
|
||||||
|
|
||||||
|
if (i > 1) {
|
||||||
|
return s + '<br />Combined: ' + t;
|
||||||
|
} else {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
@ -258,7 +266,7 @@ $(window).load(function () {
|
||||||
enabled: true
|
enabled: true
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: 'Total CPU',
|
name: 'Core 0',
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
@ -270,22 +278,22 @@ $(window).load(function () {
|
||||||
|
|
||||||
var CPUChart = $('#chart_cpu').highcharts();
|
var CPUChart = $('#chart_cpu').highcharts();
|
||||||
|
|
||||||
if({{ $server->cpu }} > 0) {
|
// if({{ $server->cpu }} > 0) {
|
||||||
CPUChart.series[0].addPoint(parseFloat(((proc.data.cpu.total / {{ $server->cpu }}) * 100).toFixed(3).toString()), true, true);
|
// CPUChart.series[0].addPoint(parseFloat(((proc.data.cpu.total / {{ $server->cpu }}) * 100).toFixed(3).toString()), true, true);
|
||||||
} else {
|
// } else {
|
||||||
CPUChart.series[0].addPoint(proc.data.cpu.total, true, true);
|
// CPUChart.series[0].addPoint(proc.data.cpu.total, true, true);
|
||||||
}
|
// }
|
||||||
for (i = 0, length = proc.data.cpu.cores.length; i < length; i++) {
|
for (i = 0, length = proc.data.cpu.cores.length; i < length; i++) {
|
||||||
if (typeof CPUChart.series[ i + 1 ] === 'undefined') {
|
if (typeof CPUChart.series[i] === 'undefined') {
|
||||||
CPUChart.addSeries({
|
CPUChart.addSeries({
|
||||||
name: 'Core ' + i,
|
name: 'Core ' + i,
|
||||||
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if({{ $server->cpu }} > 0) {
|
if({{ $server->cpu }} > 0) {
|
||||||
CPUChart.series[ i + 1 ].addPoint(parseFloat(((proc.data.cpu.cores[i] / {{ $server->cpu }}) * 100).toFixed(3).toString()), true, true);
|
CPUChart.series[i].addPoint(parseFloat(((proc.data.cpu.cores[i] / {{ $server->cpu }}) * 100).toFixed(3).toString()), true, true);
|
||||||
} else {
|
} else {
|
||||||
CPUChart.series[ i + 1 ].addPoint(proc.data.cpu.cores[i], true, true);
|
CPUChart.series[i].addPoint(proc.data.cpu.cores[i], true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue