ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-11414 Dashboard: widget for "Disk Usage" should instead show disk read/write throughput (dsen)
Date Wed, 27 May 2015 09:49:29 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk efe312923 -> d363c3d3b


AMBARI-11414 Dashboard: widget for "Disk Usage" should instead show disk read/write throughput
(dsen)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d363c3d3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d363c3d3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d363c3d3

Branch: refs/heads/trunk
Commit: d363c3d3bd22b3db2708aefbb7bbfdf4ec9921e3
Parents: efe3129
Author: Dmytro Sen <dsen@apache.org>
Authored: Wed May 27 12:32:44 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Wed May 27 12:32:44 2015 +0300

----------------------------------------------------------------------
 .../src/main/python/core/host_info.py           | 19 ++++++++++++++++-
 .../HBASE/0.96.0.2.0/metrics.json               | 22 ++++++++++++++++++++
 .../HBASE/0.96.0.2.0/widgets.json               | 19 ++++++++++-------
 .../stacks/HDP/2.3/services/HBASE/widgets.json  | 21 ++++++++++++-------
 4 files changed, 65 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d363c3d3/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
index 41f6a0a..826cd40 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/host_info.py
@@ -43,6 +43,8 @@ class HostInfo():
     self.__last_network_io_time = 0
     self.__last_network_data = {}
     self.__last_network_lock = threading.Lock()
+    self.__last_disk_io_time = 0
+    self.__last_disk_data = {}
     self.__host_static_info = self.get_host_static_info()
     self.__config = config
 
@@ -256,9 +258,16 @@ class HostInfo():
     # read_time: time spent reading from disk (in milliseconds)
     # write_time: time spent writing to disk (in milliseconds)
 
+    current_time = time.time()
+    delta = current_time - self.__last_disk_io_time
+    self.__last_disk_io_time = current_time
+
+    if delta <= 0:
+      delta = float("inf")
+
     io_counters = psutil.disk_io_counters()
 
-    return {
+    new_disk_stats = {
       'read_count' : io_counters.read_count if hasattr(io_counters, 'read_count') else 0,
       'write_count' : io_counters.write_count if hasattr(io_counters, 'write_count') else
0,
       'read_bytes' : io_counters.read_bytes if hasattr(io_counters, 'read_bytes') else 0,
@@ -266,6 +275,14 @@ class HostInfo():
       'read_time' : io_counters.read_time if hasattr(io_counters, 'read_time') else 0,
       'write_time' : io_counters.write_time if hasattr(io_counters, 'write_time') else 0
     }
+    if not self.__last_disk_data:
+      self.__last_disk_data = new_disk_stats
+    read_bps = (new_disk_stats['read_bytes'] - self.__last_disk_data['read_bytes']) / delta
+    write_bps = (new_disk_stats['write_bytes'] - self.__last_disk_data['write_bytes']) /
delta
+    self.__last_disk_data = new_disk_stats
+    new_disk_stats['read_bps'] = read_bps
+    new_disk_stats['write_bps'] = write_bps
+    return new_disk_stats
 
   def get_hostname(self):
     global cached_hostname

http://git-wip-us.apache.org/repos/asf/ambari/blob/d363c3d3/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
index efaca33..a309ec7 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/metrics.json
@@ -40,6 +40,16 @@
               "pointInTime":true,
               "temporal":true
             },
+            "metrics/disk/read_bps":{
+              "metric":"read_bps",
+              "pointInTime":true,
+              "temporal":true
+            },
+            "metrics/disk/write_bps":{
+              "metric":"write_bps",
+              "pointInTime":true,
+              "temporal":true
+            },
             "metrics/load/load_fifteen":{
               "metric":"load_fifteen",
               "pointInTime":true,
@@ -1688,6 +1698,18 @@
               "temporal":true,
               "amsHostMetric":true
             },
+            "metrics/disk/read_bps":{
+              "metric":"read_bps",
+              "pointInTime":true,
+              "temporal":true,
+              "amsHostMetric":true
+            },
+            "metrics/disk/write_bps":{
+              "metric":"write_bps",
+              "pointInTime":true,
+              "temporal":true,
+              "amsHostMetric":true
+            },
             "metrics/load/load_fifteen":{
               "metric":"load_fifteen",
               "pointInTime":true,

http://git-wip-us.apache.org/repos/asf/ambari/blob/d363c3d3/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
index 3220811..3da4fbf 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/widgets.json
@@ -341,31 +341,36 @@
         },
         {
           "widget_name": "Cluster Disk",
-          "description": "RegionServer widget for Disk utilization",
+          "description": "RegionServer widget for Disk throughput",
           "default_section_name": "HBASE_SUMMARY",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
             {
-              "name": "disk_free._sum",
-              "metric_path": "metrics/disk/disk_free._sum",
+              "name": "read_bps._sum",
+              "metric_path": "metrics/disk/read_bps._sum",
               "service_name": "HBASE",
               "component_name": "HBASE_REGIONSERVER"
             },
             {
-              "name": "disk_total._sum",
-              "metric_path": "metrics/disk/disk_total._sum",
+              "name": "write_bps._sum",
+              "metric_path": "metrics/disk/write_bps._sum",
               "service_name": "HBASE",
               "component_name": "HBASE_REGIONSERVER"
             }
           ],
           "values": [
             {
-              "name": "Disk Utlization",
-              "value": "${(disk_total._sum - disk_free._sum)/disk_total._sum}"
+              "name": "Read throughput",
+              "value": "${read_bps._sum/1048576}"
+            },
+            {
+              "name": "Write throughput",
+              "value": "${write_bps._sum/1048576}"
             }
           ],
           "properties": {
+            "display_unit": "Mbps",
             "graph_type": "LINE",
             "time_range": "1"
           }

http://git-wip-us.apache.org/repos/asf/ambari/blob/d363c3d3/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/widgets.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/widgets.json b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/widgets.json
index 2fdd30c..9e623f9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/widgets.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/HBASE/widgets.json
@@ -348,30 +348,35 @@
         },
         {
           "widget_name": "Cluster Disk",
-          "description": "RegionServer widget for Disk utilization",
+          "description": "RegionServer widget for Disk throughput",
           "widget_type": "GRAPH",
           "is_visible": true,
           "metrics": [
             {
-              "name": "disk_free._sum",
-              "metric_path": "metrics/disk/disk_free._sum",
+              "name": "read_bps._sum",
+              "metric_path": "metrics/disk/read_bps._sum",
               "service_name": "HBASE",
               "component_name": "HBASE_REGIONSERVER"
             },
             {
-              "name": "disk_total._sum",
-              "metric_path": "metrics/disk/disk_total._sum",
+              "name": "write_bps._sum",
+              "metric_path": "metrics/disk/write_bps._sum",
               "service_name": "HBASE",
               "component_name": "HBASE_REGIONSERVER"
             }
           ],
           "values": [
             {
-              "name": "Disk Utlization",
-              "value": "${(disk_total._sum - disk_free._sum)/disk_total._sum}"
+              "name": "Read throughput",
+              "value": "${read_bps._sum/1048576}"
+            },
+            {
+              "name": "Write throughput",
+              "value": "${write_bps._sum/1048576}"
             }
           ],
           "properties": {
+            "display_unit": "Mbps",
             "graph_type": "LINE",
             "time_range": "1"
           }
@@ -503,4 +508,4 @@
       ]
     }
   ]
-}
\ No newline at end of file
+}


Mime
View raw message