You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by we...@apache.org on 2022/06/03 22:34:00 UTC

[ozone] branch master updated: HDDS-6706. Exposing Volume Information Metrics to the DataNode UI (#3478)

This is an automated email from the ASF dual-hosted git repository.

weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 414d272ac9 HDDS-6706. Exposing Volume Information Metrics to the DataNode UI (#3478)
414d272ac9 is described below

commit 414d272ac9f2736358046a3de320a17f67c8c744
Author: Arafat2198 <98...@users.noreply.github.com>
AuthorDate: Sat Jun 4 04:03:55 2022 +0530

    HDDS-6706. Exposing Volume Information Metrics to the DataNode UI (#3478)
    
    Co-authored-by: Mohammad Arafat Khan <mo...@Mohammads-MacBook-Pro.local>
---
 .../webapps/hddsDatanode/dn-overview.html          | 30 ++++++++++++++++++++++
 .../src/main/resources/webapps/hddsDatanode/dn.js  | 24 +++++++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn-overview.html b/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn-overview.html
index d4f7a17c0b..0240163603 100644
--- a/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn-overview.html
+++ b/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn-overview.html
@@ -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>
\ No newline at end of file
diff --git a/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn.js b/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn.js
index c43eb42bdc..adc507acce 100644
--- a/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn.js
+++ b/hadoop-hdds/container-service/src/main/resources/webapps/hddsDatanode/dn.js
@@ -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];
+        }
 })();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org