Fix disk usage graphs

This commit is contained in:
Girish Ramakrishnan
2021-01-27 21:48:16 -08:00
parent 012968003f
commit b146d78525

View File

@@ -46,7 +46,6 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
// on scaleway, for some reason docker devices are collected as part of collectd
// until we figure why just hardcode popular disk devices - https://www.mjmwired.net/kernel/Documentation/devices.txt
Client.disks(function (error, result) {
console.dir(result);
if (error) return $scope.disks.setError(error);
// segregate locations into the correct disks based on 'filesystem'
@@ -63,7 +62,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
const apps = Object.keys(result.apps).filter(function (appId) { return result.apps[appId] === disk.filesystem; });
apps.forEach(function (appId) {
var app = Client.getCachedAppSync(appId);
disk.contains.push({ typeo: 'app', app: app, label: app.label || app.fqdn, id: appId, usage: 0 });
disk.contains.push({ type: 'app', app: app, label: app.label || app.fqdn, id: appId, usage: 0 });
});
const volumes = Object.keys(result.volumes).filter(function (volumeId) { return result.volumes[volumeId] === disk.filesystem; });
@@ -207,7 +206,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
});
}
var data = {
var chartData = {
labels: labels,
datasets: datasets
};
@@ -240,7 +239,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
var ctx = $(canvasId).get(0).getContext('2d');
if ($scope.graphs[chartPropertyName]) $scope.graphs[chartPropertyName].destroy();
$scope.graphs[chartPropertyName] = new Chart(ctx, { type: 'line', data: data, options: options });
$scope.graphs[chartPropertyName] = new Chart(ctx, { type: 'line', data: chartData, options: options });
}
var cpuQuery = 'summarize(sum(collectd.localhost.aggregation-cpu-average.cpu-system, collectd.localhost.aggregation-cpu-average.cpu-user), "' + timeBucketSize + 'min", "avg")';
@@ -248,7 +247,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
var appQueries = [];
apps.forEach(function (app) {
appQueries.push('summarize(collectd.localhost.table-' + app.id + '-memory.gauge-rss, "' + timeBucketSize + 'min", "avg")')
appQueries.push('summarize(collectd.localhost.table-' + app.id + '-memory.gauge-rss, "' + timeBucketSize + 'min", "avg")');
});
Client.graphs([ cpuQuery, systemMemoryQuery ].concat(appQueries), '-' + timePeriod + 'min', {}, function (error, result) {