graphs: ubuntu is only on the root mount point
This commit is contained in:
@@ -158,6 +158,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
Client.disks(function (error, result) {
|
||||
if (error) return $scope.setError('disk', error);
|
||||
|
||||
// segregate locations into the correct disks based on 'filesystem'
|
||||
result.disks.forEach(function (disk, index) {
|
||||
disk.id = index;
|
||||
disk.contains = [];
|
||||
@@ -177,13 +178,14 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
|
||||
$scope.disks = result.disks; // [ { filesystem, type, size, used, available, capacity, mountpoint }]
|
||||
|
||||
// lazy fetch graphite data
|
||||
$scope.disks.forEach(function (disk) {
|
||||
// render data of each disk
|
||||
$scope.disks.forEach(function (disk, index) {
|
||||
// /dev/sda1 -> sda1
|
||||
// /dev/mapper/foo -> mapper_foo (see #348)
|
||||
var diskName = disk.filesystem.slice(disk.filesystem.indexOf('/', 1) + 1);
|
||||
diskName = diskName.replace(/\//g, '_');
|
||||
|
||||
// use collectd instead of df data so the timeframe matches with the du data
|
||||
Client.graphs([
|
||||
'absolute(collectd.localhost.df-' + diskName + '.df_complex-free)',
|
||||
'absolute(collectd.localhost.df-' + diskName + '.df_complex-reserved)',
|
||||
@@ -221,13 +223,14 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
usageOther -= tmp;
|
||||
});
|
||||
|
||||
// add content container for other non tracked data.
|
||||
disk.contains.push({
|
||||
label: 'Ubuntu',
|
||||
id: 'other',
|
||||
color: '#27CE65',
|
||||
usage: usageOther
|
||||
});
|
||||
if (index === 0) { // the root mount point is the first disk
|
||||
disk.contains.push({
|
||||
label: 'Ubuntu',
|
||||
id: 'other',
|
||||
color: '#27CE65',
|
||||
usage: usageOther
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user