Переглянути джерело

AMBARI-1013. Host metrics charts should use live data (Srimanth Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418942 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 роки тому
батько
коміт
465917e291

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -470,6 +470,9 @@ AMBARI-666 branch (unreleased changes)
 
   BUG FIXES
 
+  AMBARI-1013. Host metrics charts should use live data. (Srimanth Gunturi
+  via yusaku)
+
   AMBARI-1009. Cluster level graphs need to use API for data. (Srimanth
   Gunturi via yusaku)
 

+ 6 - 6
ambari-web/app/templates/main/host/metrics.hbs

@@ -18,21 +18,21 @@
 
 <div class="host-metrics">
 	<div class="span4">
-	  {{view App.ChartHostMetricsCPU}}
+	  {{view App.ChartHostMetricsCPU contentBinding="view.content"}}
 	</div> 
 	<div class="span4">
-	  {{view App.ChartHostMetricsDisk}}
+	  {{view App.ChartHostMetricsDisk contentBinding="view.content"}}
 	</div> 
 	<div class="span4">
-	  {{view App.ChartHostMetricsLoad}}
+	  {{view App.ChartHostMetricsLoad contentBinding="view.content"}}
 	</div> 
 	<div class="span4">
-	  {{view App.ChartHostMetricsMemory}}
+	  {{view App.ChartHostMetricsMemory contentBinding="view.content"}}
 	</div> 
 	<div class="span4">
-	  {{view App.ChartHostMetricsNetwork}}
+	  {{view App.ChartHostMetricsNetwork contentBinding="view.content"}}
 	</div> 
 	<div class="span4">
-	  {{view App.ChartHostMetricsProcesses}}
+	  {{view App.ChartHostMetricsProcesses contentBinding="view.content"}}
 	</div> 
 </div>

+ 1 - 1
ambari-web/app/templates/main/host/summary.hbs

@@ -90,7 +90,7 @@
         <h4>Host Metrics</h4>
       </div>
       <div class="row-fluid">
-	     {{view App.MainHostMetricsView}}
+	     {{view App.MainHostMetricsView contentBinding="view.content"}}
 	    </div>
 	  </div>
   </div>

+ 2 - 1
ambari-web/app/views/main/host/metrics/cpu.js

@@ -33,7 +33,8 @@ App.ChartHostMetricsCPU = App.ChartLinearTimeView.extend({
 
   url: function () {
     return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_wio[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_nice[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_aidle[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_system[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_idle[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/cpu.json");
   }.property('App.router.clusterController.clusterName'),
 

+ 6 - 2
ambari-web/app/views/main/host/metrics/disk.js

@@ -32,14 +32,18 @@ App.ChartHostMetricsDisk = App.ChartLinearTimeView.extend({
   yAxisFormatter: App.ChartLinearTimeView.BytesFormatter,
 
   url: function () {
-    return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/disk/disk_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/part_max_used[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/disk_free[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+    return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/disk/disk_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/part_max_used[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/disk_free[{fromSeconds},{toSeconds},{stepSeconds}]", {
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/disk.json");
   }.property('App.router.clusterController.clusterName'),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
     if (jsonData && jsonData.metrics && jsonData.metrics.disk) {
+      if(jsonData.metrics.part_max_used){
+        jsonData.metrics.disk.part_max_used = jsonData.metrics.part_max_used;
+      }
       for ( var name in jsonData.metrics.disk) {
         var displayName;
         var seriesData = jsonData.metrics.disk[name];

+ 2 - 1
ambari-web/app/views/main/host/metrics/load.js

@@ -32,7 +32,8 @@ App.ChartHostMetricsLoad = App.ChartLinearTimeView.extend({
 
   url: function () {
     return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/load/load_fifteen[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_one[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_five[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/load.json");
   }.property('App.router.clusterController.clusterName'),
 

+ 2 - 1
ambari-web/app/views/main/host/metrics/memory.js

@@ -33,7 +33,8 @@ App.ChartHostMetricsMemory = App.ChartLinearTimeView.extend({
 
   url: function () {
     return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/memory/swap_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_cached[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_buffers[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/memory.json");
   }.property('App.router.clusterController.clusterName'),
 

+ 2 - 1
ambari-web/app/views/main/host/metrics/network.js

@@ -33,7 +33,8 @@ App.ChartHostMetricsNetwork = App.ChartLinearTimeView.extend({
 
   url: function () {
     return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/network/bytes_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/bytes_out[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_out[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/network.json");
   }.property('App.router.clusterController.clusterName'),
 

+ 6 - 5
ambari-web/app/views/main/host/metrics/processes.js

@@ -31,17 +31,18 @@ App.ChartHostMetricsProcesses = App.ChartLinearTimeView.extend({
   title: "Processes",
 
   url: function () {
-    return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/processes/proc_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/processes/proc_run[{fromSeconds},{toSeconds},{stepSeconds}]", {
-      clusterName: App.router.get('clusterController.clusterName')
+    return App.formatUrl("/api/clusters/{clusterName}/hosts/{hostName}?fields=metrics/process/proc_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/process/proc_run[{fromSeconds},{toSeconds},{stepSeconds}]", {
+      clusterName: App.router.get('clusterController.clusterName'),
+      hostName: this.get('content').get('hostName')
     }, "/data/hosts/metrics/processes.json");
   }.property('App.router.clusterController.clusterName'),
 
   transformToSeries: function (jsonData) {
     var seriesArray = [];
-    if (jsonData && jsonData.metrics && jsonData.metrics.processes) {
-      for ( var name in jsonData.metrics.processes) {
+    if (jsonData && jsonData.metrics && jsonData.metrics.process) {
+      for ( var name in jsonData.metrics.process) {
         var displayName;
-        var seriesData = jsonData.metrics.processes[name];
+        var seriesData = jsonData.metrics.process[name];
         switch (name) {
           case "proc_total":
             displayName = "Total Processes";