mirror of
https://github.com/nicolargo/glances.git
synced 2025-01-06 09:47:09 +03:00
WebUI : adds raid plugin
This commit is contained in:
parent
1945db14fc
commit
783b5d98e6
@ -35,6 +35,7 @@
|
||||
<script type="text/javascript" src="services/plugins/glances_processcount.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_processlist.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_quicklook.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_raid.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_sensors.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_system.js"></script>
|
||||
<script type="text/javascript" src="services/plugins/glances_uptime.js"></script>
|
||||
|
19
glances/outputs/static/html/plugins/raid.html
Normal file
19
glances/outputs/static/html/plugins/raid.html
Normal file
@ -0,0 +1,19 @@
|
||||
<div class="table-row">
|
||||
<div class="table-cell text-left title">RAID disks</div>
|
||||
<div class="table-cell">Used</div>
|
||||
<div class="table-cell">Total</div>
|
||||
</div>
|
||||
<div class="table-row" ng-repeat="disk in statsRaid.disks | orderBy: 'name'">
|
||||
<div class="table-cell text-left">
|
||||
{{ disk.type | uppercase }} {{ disk.name }}
|
||||
<div class="warning" ng-show="disk.degraded">└─ Degraded mode</div>
|
||||
<div ng-show="disk.degraded"> └─ {{ disk.config }}</div>
|
||||
|
||||
<div class="critical" ng-show="disk.inactive">└─ Status {{ disk.status }}</div>
|
||||
<div ng-show="disk.inactive" ng-repeat="component in disk.components | orderBy: 'number'">
|
||||
{{ $last ? '└─' : '├─' }} disk {{ component.number }}: {{ component.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-cell" ng-show="!disk.inactive" ng-class="statsRaid.getAlert(disk)">{{ disk.used }}</div>
|
||||
<div class="table-cell" ng-show="!disk.inactive" ng-class="statsRaid.getAlert(disk)">{{ disk.available }}</div>
|
||||
</div>
|
@ -51,6 +51,7 @@
|
||||
<section id="network" class="plugin table-row-group" ng-show="show.network" ng-include src="'plugins/network.html'"></section>
|
||||
<section id="diskio" class="plugin table-row-group" ng-show="show.diskio" ng-include src="'plugins/diskio.html'"></section>
|
||||
<section id="fs" class="plugin table-row-group" ng-show="show.fs" ng-include src="'plugins/fs.html'"></section>
|
||||
<section id="raid" class="plugin table-row-group" ng-show="show.fs" ng-include src="'plugins/raid.html'"></section>
|
||||
<section id="sensors" class="plugin table-row-group" ng-show="show.sensors && statsSensors.sensors.length > 0" ng-include src="'plugins/sensors.html'"></section>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -17,6 +17,7 @@ glancesApp.service('GlancesStats', function($http, $injector, $q, GlancesPlugin)
|
||||
'processcount': 'GlancesPluginProcessCount',
|
||||
'processlist': 'GlancesPluginProcessList',
|
||||
'quicklook': 'GlancesPluginQuicklook',
|
||||
'raid': 'GlancesPluginRaid',
|
||||
'sensors': 'GlancesPluginSensors',
|
||||
'system': 'GlancesPluginSystem',
|
||||
'uptime': 'GlancesPluginUptime'
|
||||
|
44
glances/outputs/static/js/services/plugins/glances_raid.js
Normal file
44
glances/outputs/static/js/services/plugins/glances_raid.js
Normal file
@ -0,0 +1,44 @@
|
||||
glancesApp.service('GlancesPluginRaid', function () {
|
||||
var _pluginName = "raid";
|
||||
this.disks = [];
|
||||
|
||||
this.setData = function (data, views) {
|
||||
this.disks = [];
|
||||
data = data[_pluginName];
|
||||
|
||||
_.forIn(data, function(diskData, diskKey) {
|
||||
var disk = {
|
||||
'name': diskKey,
|
||||
'type': diskData.type == null ? 'UNKNOWN' : diskData.type,
|
||||
'used': diskData.used,
|
||||
'available': diskData.available,
|
||||
'status': diskData.status,
|
||||
'degraded': diskData.used < diskData.available,
|
||||
'config': diskData.config == null ? '' : diskData.config.replace('_', 'A'),
|
||||
'inactive': diskData.status == 'inactive',
|
||||
'components': []
|
||||
};
|
||||
|
||||
_.forEach(diskData.components, function(number, name) {
|
||||
disk.components.push({
|
||||
'number': number,
|
||||
'name': name
|
||||
});
|
||||
});
|
||||
|
||||
this.disks.push(disk);
|
||||
}, this);
|
||||
};
|
||||
|
||||
this.getAlert = function(disk) {
|
||||
if (disk.inactive) {
|
||||
return 'critical';
|
||||
}
|
||||
|
||||
if (disk.degraded) {
|
||||
return 'warning';
|
||||
}
|
||||
|
||||
return 'ok'
|
||||
}
|
||||
});
|
@ -73,6 +73,7 @@ glancesApp.controller('statsController', function ($scope, $interval, $routePara
|
||||
$scope.statsProcessCount = GlancesStats.getPlugin('processcount');
|
||||
$scope.statsProcessList = GlancesStats.getPlugin('processlist');
|
||||
$scope.statsQuicklook = GlancesStats.getPlugin('quicklook');
|
||||
$scope.statsRaid = GlancesStats.getPlugin('raid');
|
||||
$scope.statsSensors = GlancesStats.getPlugin('sensors');
|
||||
$scope.statsSystem = GlancesStats.getPlugin('system');
|
||||
$scope.statsUptime = GlancesStats.getPlugin('uptime');
|
||||
|
Loading…
Reference in New Issue
Block a user