/usr/lib/python3/dist-packages/glances/outputs/static/js/services/core/glances_stats.js is in glances 2.7.1.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | glancesApp.service('GlancesStats', function($http, $injector, $q, GlancesPlugin) {
var _stats = [], _views = [], _limits = [];
var _plugins = {
'alert': 'GlancesPluginAlert',
'cpu': 'GlancesPluginCpu',
'diskio': 'GlancesPluginDiskio',
'irq' : 'GlancesPluginIrq',
'docker': 'GlancesPluginDocker',
'ip': 'GlancesPluginIp',
'fs': 'GlancesPluginFs',
'folders': 'GlancesPluginFolders',
'load': 'GlancesPluginLoad',
'mem': 'GlancesPluginMem',
'memswap': 'GlancesPluginMemSwap',
'amps': 'GlancesPluginAmps',
'network': 'GlancesPluginNetwork',
'percpu': 'GlancesPluginPerCpu',
'processcount': 'GlancesPluginProcessCount',
'processlist': 'GlancesPluginProcessList',
'quicklook': 'GlancesPluginQuicklook',
'raid': 'GlancesPluginRaid',
'sensors': 'GlancesPluginSensors',
'system': 'GlancesPluginSystem',
'uptime': 'GlancesPluginUptime',
'ports': 'GlancesPluginPorts'
};
this.getData = function() {
return $q.all([
this.getAllStats(),
this.getAllViews()
]).then(function(results) {
return {
'stats': results[0],
'view': results[1]
};
});
};
this.getAllStats = function() {
return $http.get('/api/2/all').then(function (response) {
_stats = response.data;
return response.data;
});
};
this.getAllLimits = function() {
return $http.get('/api/2/all/limits').then(function (response) {
_limits = response.data;
return response.data;
});
};
this.getAllViews = function() {
return $http.get('/api/2/all/views').then(function (response) {
_views = response.data;
return response.data;
});
};
this.getHelp = function() {
return $http.get('/api/2/help').then(function (response) {
return response.data;
});
};
this.getArguments = function() {
return $http.get('/api/2/args').then(function (response) {
return response.data;
});
};
this.getPlugin = function(name) {
var plugin = _plugins[name];
if (plugin === undefined) {
throw "Plugin '" + name + "' not found";
}
plugin = $injector.get(plugin);
plugin.setData(_stats, _views);
return plugin;
};
// load limits to init GlancePlugin helper
this.getAllLimits().then(function(limits) {
GlancesPlugin.setLimits(limits);
});
});
|