1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

Added remaining memory stats, change humansize filter to give more accurate sizes.

This commit is contained in:
Kevan Ahlquist 2015-08-28 23:26:39 -05:00
parent b99fe5bf55
commit 5a51495432
5 changed files with 59 additions and 35 deletions

View file

@ -1,24 +1,41 @@
<div class="row">
<div class="col-xs-12">
<h1>Stats</h1>
<h2>CPU Usage</h2>
<div class="row">
<div class="col-sm-8">
<canvas id="cpu-stats-chart" width="700" height="300"></canvas>
</div>
<div class="col-sm-4">
<h3>Other CPU usage data</h3>
<p>TODO</p>
<div class="col-sm-7">
<canvas id="cpu-stats-chart" width="650" height="300"></canvas>
</div>
</div>
<h2>Memory</h2>
<div class="row">
<div class="col-sm-8">
<canvas id="memory-stats-chart" width="700" height="300"></canvas>
<div class="col-sm-7">
<canvas id="memory-stats-chart" width="650" height="300"></canvas>
</div>
<div class="col-sm-4">
<h3>Other Memory Stats</h3>
<p>TODO</p>
<div class="col-sm-offset-1 col-sm-4">
<table class="table">
<tr>
<td>Max usage</td>
<td>{{ data.memory_stats.max_usage | humansize }}</td>
</tr>
<tr>
<td>Limit</td>
<td>{{ data.memory_stats.limit | humansize }}</td>
</tr>
</table>
<accordion>
<accordion-group heading="Other stats">
<table class="table">
<tr ng-repeat="(key, value) in data.memory_stats.stats">
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
</table>
</accordion-group>
</accordion>
</div>
</div>
</div>

View file

@ -56,9 +56,9 @@ angular.module('stats', [])
},
{
scaleLabel: function (valueObj) {
return humansizeFilter(parseInt(valueObj.value));
return humansizeFilter(parseInt(valueObj.value, 10));
},
responsive: true,
responsive: true
//scaleOverride: true,
//scaleSteps: 10,
//scaleStepWidth: Math.ceil(initialStats.memory_stats.limit / 10),
@ -77,14 +77,20 @@ angular.module('stats', [])
}
// Update graph with latest data
$scope.data = d;
updateChart(d);
updateMemoryChart(d);
$timeout(updateStats, 1000); // TODO: Switch to setInterval for more consistent readings
timeout = $timeout(updateStats, 1000);
}, function () {
Messages.error('Unable to retrieve stats', 'Is this container running?');
});
}
var timeout;
$scope.$on('$destroy', function () {
$timeout.cancel(timeout);
});
updateStats();
function updateChart(data) {
@ -116,8 +122,7 @@ angular.module('stats', [])
//console.log('size thing:', curCpu.cpu_usage.percpu_usage);
cpuPercent = (cpuDelta / systemDelta) * curCpu.cpu_usage.percpu_usage.length * 100.0;
}
return Math.random() * 100;
//return cpuPercent; TODO: Switch back to the real value
return cpuPercent;
}
}])
;