Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,38 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head><title>DataNode UI</title></head>
<body>
<table class="table table-bordered table-striped" class="col-md-6">
<tbody>
</tbody>
</table>

<h2>Volume Information</h2>
<table class="table table-bordered table-striped" class="col-md-6">
<thead>
<tr>
<th>Directory</th>
<th>Storage Type</th>
<th>Volume Type</th>
<th>Used Space</th>
<th>Available Space</th>
<th>Reserved</th>
<th>Total Capacity</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="volumeInfo in $ctrl.dnmetrics">
<td>{{volumeInfo["tag.StorageDirectory"]}}</td>
<td>{{volumeInfo["tag.StorageType"]}}</td>
<td>{{volumeInfo["tag.VolumeType"]}}</td>
<td>{{volumeInfo.Used}}</td>
<td>{{volumeInfo.Available}}</td>
<td>{{volumeInfo.Reserved}}</td>
<td>{{volumeInfo.TotalCapacity}}</td>
</tr>
</tbody>
</table>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,30 @@
},
controller: function ($http) {
var ctrl = this;
$http.get("jmx?qry=Hadoop:service=HddsDatanode,name=StorageContainerMetrics")
$http.get("jmx?qry=Hadoop:service=HddsDatanode,name=VolumeInfoMetrics*")
.then(function (result) {
ctrl.dnmetrics = result.data.beans[0];
ctrl.dnmetrics = result.data.beans;
ctrl.dnmetrics.forEach(volume => {
volume.Used = transform(volume.Used);
volume.Available = transform(volume.Available);
volume.Reserved = transform(volume.Reserved);
volume.TotalCapacity = transform(volume.TotalCapacity);
})
});
}
});
function transform(v) {
var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'ZB'];
var prev = 0, i = 0;
while (Math.floor(v) > 0 && i < UNITS.length) {
prev = v;
v /= 1024;
i += 1;
}
if (i > 0 && i < UNITS.length) {
v = prev;
i -= 1;
}
return Math.round(v * 100) / 100 + ' ' + UNITS[i];
}
})();