Use the new disks api to explicitly get the apps data disk stats

We can add the other graphs if the disks deviate later

Also this is still pending the check if symlinked folders are reported
correctly.

Fixes #290
This commit is contained in:
Johannes Zellner
2017-04-07 18:46:09 +02:00
parent f2312a6768
commit b422a27be8
2 changed files with 20 additions and 6 deletions

View File

@@ -761,6 +761,13 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification',
}).error(defaultErrorHandler(callback));
};
Client.prototype.disks = function (callback) {
get('/api/v1/cloudron/disks').success(function (data, status) {
if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data));
callback(null, data);
}).error(defaultErrorHandler(callback));
};
Client.prototype.graphs = function (targets, from, callback) {
var config = {
params: {

View File

@@ -108,14 +108,21 @@ angular.module('Application').controller('GraphsController', ['$scope', '$locati
// https://graphite.readthedocs.io/en/latest/render_api.html#paths-and-wildcards
// 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.graphs([
'averageSeries(collectd.localhost.df-{sd,hd,vd,md,ad,nb,vd,ub,xvd}*.df_complex-free)',
'averageSeries(collectd.localhost.df-{sd,hd,vd,md,ad,nb,vd,ub,xvd}*.df_complex-reserved)',
'averageSeries(collectd.localhost.df-{sd,hd,vd,md,ad,nb,vd,ub,xvd}*.df_complex-used)'
], '-1min', function (error, data) {
Client.disks(function (error, disks) {
if (error) return console.log(error);
renderDisk('system', data[0], data[1], data[2]);
// We have to see if this is sufficient for all server configurations
var appDataDiskName = disks.appsDataDisk.slice(disks.appsDataDisk.lastIndexOf('/') + 1)
Client.graphs([
'absolute(collectd.localhost.df-' + appDataDiskName + '.df_complex-free)',
'absolute(collectd.localhost.df-' + appDataDiskName + '.df_complex-reserved)',
'absolute(collectd.localhost.df-' + appDataDiskName + '.df_complex-used)'
], '-1min', function (error, data) {
if (error) return console.log(error);
renderDisk('system', data[0], data[1], data[2]);
});
});
};