Skip to content
Browse files

AMBARI-1032. Host hover in cluster heatmap showing mock data. (Sriman…

…th Gunturi via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418971 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 0eabc1a commit 59100605114056bb819e6e568af24dd20b4a350d Yusaku Sako committed Dec 9, 2012
View
3 AMBARI-666-CHANGES.txt
@@ -491,6 +491,9 @@ AMBARI-666 branch (unreleased changes)
OPTIMIZATIONS
BUG FIXES
+
+ AMBARI-1032. Host hover in cluster heatmap showing mock data. (Srimanth
+ Gunturi via yusaku)
AMBARI-1028. MapReduce & HDFS summaries should use ServiceComponentInfo
values. (Srimanth Gunturi via yusaku)
View
12 ambari-web/app/controllers/main/charts/heatmap_metrics/heatmap_metric_processrun.js
@@ -33,5 +33,13 @@ App.MainChartHeatmapProcessRunMetric = App.MainChartHeatmapMetric.extend({
name: 'Total Running Processes',
maximumValue: 1,
defaultMetric: 'metrics.process.proc_run',
- units: 'Processes'
-})
+ units: 'Processes',
+ metricMapper: function (json) {
+ var map = this._super(json);
+ for ( var host in map) {
+ var val = map[host];
+ map[host] = val.toFixed(1);
+ }
+ return map;
+ }
+});
View
80 ambari-web/app/mappers/hosts_mapper.js
@@ -1,71 +1,85 @@
/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
*/
-
App.hostsMapper = App.QuickDataMapper.create({
- model : App.Host,
- config : {
- id : 'Hosts.host_name',
- host_name : 'Hosts.host_name',
- cluster_id: 'Hosts.cluster_name',//1
+ model: App.Host,
+ config: {
+ id: 'Hosts.host_name',
+ host_name: 'Hosts.host_name',
+ cluster_id: 'Hosts.cluster_name',// 1
components_key: 'host_components',
components_type: 'array',
components: {
- item : 'HostRoles.component_name'
+ item: 'HostRoles.component_name'
},
rack: 'Hosts.rack_info',
host_components_key: 'host_components',
host_components_type: 'array',
host_components: {
item: 'id'
},
- cpu : 'Hosts.cpu_count',
- memory : 'Hosts.total_mem',
+ cpu: 'Hosts.cpu_count',
+ memory: 'Hosts.total_mem',
disk_info: 'Hosts.disk_info',
- $disk_usage: '-',
+ disk_usage: 'disk_usage',
health_status: 'Hosts.host_status',
load_one: 'Hosts.load.load_one',
load_five: 'Hosts.load.load_five',
load_fifteen: 'Hosts.load.load_fifteen',
- $cpu_usage: 33,
- $memory_usage: 26,
+ cpu_usage: 'cpu_usage',
+ memory_usage: 'memory_usage',
$network_usage: 36,
$io_usage: 39,
- last_heart_beat_time : "Hosts.last_heartbeat_time",
- os_arch : 'Hosts.os_arch',
- os_type : 'Hosts.os_type',
- ip : 'Hosts.ip'
+ last_heart_beat_time: "Hosts.last_heartbeat_time",
+ os_arch: 'Hosts.os_arch',
+ os_type: 'Hosts.os_type',
+ ip: 'Hosts.ip'
},
map: function (json) {
if (!this.get('model')) {
return;
}
if (json.items) {
var result = [];
-
json.items.forEach(function (item) {
- item.host_components.forEach(function(host_component){
+ // Disk Usage
+ if (item.metrics && item.metrics.disk && item.metrics.disk.disk_total && item.metrics.disk.disk_free) {
+ var diskUsed = item.metrics.disk.disk_total - item.metrics.disk.disk_free;
+ var diskUsedPercent = (100 * diskUsed) / item.metrics.disk.disk_total;
+ item.disk_usage = diskUsedPercent.toFixed(1);
+ }
+ // CPU Usage
+ if (item.metrics && item.metrics.cpu && item.metrics.cpu.cpu_system && item.metrics.cpu.cpu_user) {
+ var cpuUsedPercent = item.metrics.cpu.cpu_system + item.metrics.cpu.cpu_user;
+ item.cpu_usage = cpuUsedPercent.toFixed(1);
+ }
+ // Memory Usage
+ if (item.metrics && item.metrics.memory && item.metrics.memory.mem_free && item.metrics.memory.mem_total) {
+ var memUsed = item.metrics.memory.mem_total - item.metrics.memory.mem_free;
+ var memUsedPercent = (100 * memUsed) / item.metrics.memory.mem_total;
+ item.memory_usage = memUsedPercent.toFixed(1);
+ }
+ item.host_components.forEach(function (host_component) {
host_component.id = host_component.HostRoles.component_name + "_" + host_component.HostRoles.host_name;
}, this);
result.push(this.parseIt(item, this.config));
}, this);
- //console.log(this.get('model'), result);
+ // console.log(this.get('model'), result);
App.store.loadMany(this.get('model'), result);
}
}
View
3 ambari-web/app/templates/main/charts/heatmap/heatmap_host_detail.hbs
@@ -22,7 +22,6 @@ IP: {{view.details.ip}}<br/>
{{#if view.details.metricName}}
{{view.details.metricName}}: {{view.details.metricValue}}<br/>
{{/if}}
+Disk: {{view.details.diskUsage}}% <br/>
CPU: {{view.details.cpuUsage}}%<br/>
Memory: {{view.details.memoryUsage}}%<br/>
-Network: {{view.details.networkUsage}}%<br/>
-I/O: {{view.details.ioUsage}}%
View
5 ambari-web/app/views/main/charts/heatmap/heatmap_host_detail.js
@@ -28,9 +28,8 @@ App.MainChartsHeatmapHostDetailView = Em.View.extend({
ip: '192.168.0.0',
metricName: 'metric-name',
metricValue: 'metric-value',
+ diskUsage: '10',
cpuUsage: '10',
- memoryUsage: '10',
- networkUsage: '30',
- ioUsage: '40'
+ memoryUsage: '10'
}
});

0 comments on commit 5910060

Please sign in to comment.
Something went wrong with that request. Please try again.