Merge pull request #770 from notFloran/webui-disk-io

[WebUI] Add IOps in the DiskIO plugin
This commit is contained in:
Nicolas Hennion 2016-01-10 15:34:36 +01:00
commit 4cb61f2804
4 changed files with 29 additions and 10 deletions

View File

@ -40,7 +40,7 @@
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">{{help.show_hide_filesystem}}</div>
<div class="col-sm-12 col-lg-6"></div>
<div class="col-sm-12 col-lg-6">{{help.diskio_iops}}</div>
</div>
<div class="row">
<div class="col-sm-12 col-lg-6">{{help.show_hide_network}}</div>

View File

@ -1,10 +1,16 @@
<div class="table-row">
<div class="table-cell text-left title">DISK I/O</div>
<div class="table-cell">R/s</div>
<div class="table-cell">W/s</div>
<div class="table-cell" ng-show="!show.diskio_iops">R/s</div>
<div class="table-cell" ng-show="!show.diskio_iops">W/s</div>
<div class="table-cell" ng-show="show.diskio_iops">IOR/s</div>
<div class="table-cell" ng-show="show.diskio_iops">IOW/s</div>
</div>
<div class="table-row" ng-repeat="disk in statsDiskio.disks | orderBy: 'name'">
<div class="table-row" ng-repeat="disk in statsDiskio.disks">
<div class="table-cell text-left">{{disk.name | min_size}}</div>
<div class="table-cell">{{disk.readBytes | bytes}}</div>
<div class="table-cell">{{disk.writeBytes | bytes}}</div>
<div class="table-cell" ng-show="!show.diskio_iops">{{disk.bitrate.txps }}</div>
<div class="table-cell" ng-show="!show.diskio_iops">{{disk.bitrate.rxps }}</div>
<div class="table-cell" ng-show="show.diskio_iops">{{disk.count.txps }}</div>
<div class="table-cell" ng-show="show.diskio_iops">{{disk.count.rxps }}</div>
</div>

View File

@ -1,18 +1,26 @@
glancesApp.service('GlancesPluginDiskio', function() {
glancesApp.service('GlancesPluginDiskio', function($filter) {
var _pluginName = "diskio";
this.disks = [];
this.setData = function(data, views) {
data = data[_pluginName];
data = $filter('orderBy')(data,'disk_name');
this.disks = [];
for (var i = 0; i < data.length; i++) {
var diskioData = data[i];
var timeSinceUpdate = diskioData['time_since_update'];
var diskio = {
'name': diskioData['disk_name'],
'readBytes': diskioData['read_bytes'],
'writeBytes': diskioData['write_bytes']
'bitrate': {
'txps': $filter('bytes')(diskioData['read_bytes'] / timeSinceUpdate),
'rxps': $filter('bytes')(diskioData['write_bytes'] / timeSinceUpdate)
},
'count': {
'txps': $filter('bytes')(diskioData['read_count'] / timeSinceUpdate),
'rxps': $filter('bytes')(diskioData['write_count'] / timeSinceUpdate)
}
};
this.disks.push(diskio);

View File

@ -34,7 +34,8 @@ glancesApp.controller('statsController', function ($scope, $rootScope, $interval
'network_io_cumulative': false,
'filesystem_freespace': false,
'network_by_bytes': false,
'filesystem_free_space': false
'filesystem_free_space': false,
'diskio_iops': false
};
$scope.init_refresh_time = function () {
@ -196,6 +197,10 @@ glancesApp.controller('statsController', function ($scope, $rootScope, $interval
// b => Bytes or bits for network I/O
$scope.show_hide('network_by_bytes');
break;
case $event.shiftKey && $event.keyCode == keycodes.b:
// 'B' => Switch between bit/s and IO/s for Disk IO
$scope.show_hide('diskio_iops');
break;
case !$event.shiftKey && $event.keyCode == keycodes.l:
// l => Show/hide alert logs
$scope.show_hide('alert');