Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C921C200BFF for ; Tue, 17 Jan 2017 09:10:15 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id C7EF3160B46; Tue, 17 Jan 2017 08:10:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C19C9160B43 for ; Tue, 17 Jan 2017 09:10:14 +0100 (CET) Received: (qmail 54542 invoked by uid 500); 17 Jan 2017 08:10:14 -0000 Mailing-List: contact commits-help@eagle.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.apache.org Delivered-To: mailing list commits@eagle.apache.org Received: (qmail 54524 invoked by uid 99); 17 Jan 2017 08:10:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2017 08:10:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BA6B0DFB3D; Tue, 17 Jan 2017 08:10:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hao@apache.org To: commits@eagle.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: eagle git commit: [EAGLE-863] Refactor Topology Monitoring Widgets Date: Tue, 17 Jan 2017 08:10:13 +0000 (UTC) archived-at: Tue, 17 Jan 2017 08:10:16 -0000 Repository: eagle Updated Branches: refs/heads/master 2534a34c5 -> 1550c8954 [EAGLE-863] Refactor Topology Monitoring Widgets [EAGLE-863] Refactor Topology Monitoring Widgets - Define master,regionservers information in HBase widget. https://issues.apache.org/jira/browse/EAGLE-845 [IMPROVEMENT] Refactor HBase summary information - Add backup master page - Add some metric. Author: chitin Closes #780 from chitin/widgetandsummary. Project: http://git-wip-us.apache.org/repos/asf/eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/1550c895 Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/1550c895 Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/1550c895 Branch: refs/heads/master Commit: 1550c8954b23b443ac41f6d13a7caa02d2a6af6a Parents: 2534a34 Author: chitin Authored: Tue Jan 17 16:09:59 2017 +0800 Committer: Hao Chen Committed: Tue Jan 17 16:09:59 2017 +0800 ---------------------------------------------------------------------- .../hadoop_metric/ctrls/backupMasterListCtrl.js | 33 +++++ .../app/apps/hadoop_metric/ctrls/overview.js | 60 +++++++--- .../main/webapp/app/apps/hadoop_metric/index.js | 23 +++- .../partials/backupMasterList.html | 52 ++++++++ .../apps/hadoop_metric/partials/overview.html | 45 ++++--- .../app/apps/hadoop_metric/style/index.css | 14 +++ .../hadoop_metric/widgets/availabilityChart.js | 119 ++++++++++++------- 7 files changed, 264 insertions(+), 82 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/eagle/blob/1550c895/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js ---------------------------------------------------------------------- diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js new file mode 100644 index 0000000..d7cdc45 --- /dev/null +++ b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js @@ -0,0 +1,33 @@ +/* + * 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. + */ + +(function () { + /** + * `register` without params will load the module which using require + */ + register(function (hadoopMetricApp) { + + hadoopMetricApp.controller("backupMasterListCtrl", function ($wrapState, $scope, PageConfig, METRIC) { + + // Initialization + PageConfig.title = "HBASE BackupMasters"; + $scope.site = $wrapState.param.siteId; + $scope.backupMasterList = METRIC.hbaseMaster($scope.site, "standby", 1000); + }); + }); +})(); http://git-wip-us.apache.org/repos/asf/eagle/blob/1550c895/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js ---------------------------------------------------------------------- diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js index 4cf3e97..1efd47b 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js +++ b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js @@ -24,7 +24,7 @@ hadoopMetricApp.controller("overviewCtrl", function ($q, $wrapState, $scope, PageConfig, METRIC, Time) { var cache = {}; $scope.site = $wrapState.param.siteId; - var activeMasterInfo = METRIC.hbaseActiveMaster($scope.site); + var activeMasterInfo = METRIC.hbaseMaster($scope.site, "active", 1); PageConfig.title = 'HBase'; var storageOption = { @@ -132,34 +132,66 @@ }); }); + METRIC.regionserverStatus($scope.hostname, $scope.site)._promise.then(function (res) { + $scope.regionstatus = res; + }); + hbaseservers._promise.then(function (res) { - var regionhealtynum = 0; - var regiontotal = 0; - var hmasteractive; - var hmasterstandby; + var regionserverhealtynum = 0; + var regionservertotal = 0; + var hmasterstandbynum = 0; + var hmasteractivenum = 0; + var regionsnum = 0; + var regionArray = []; $.each(res, function (i, server) { var role = server.tags.role; var status = server.status; if (role === "regionserver") { - regiontotal++; + regionservertotal++; if (status === "live") { - regionhealtynum++; + regionserverhealtynum++; } + regionArray.push(METRIC.regionserverStatus(server.tags.hostname, $scope.site)._promise.then(function (res) { + return res[0].numRegions; + })); } else if (role === "hmaster") { if (status === "active") { - hmasteractive = server; + hmasteractivenum++; } else { - hmasterstandby = server; + hmasterstandbynum++; } } }); - $scope.regionhealtynum = regionhealtynum; - $scope.regiontotal = regiontotal; - $scope.hmasteractive = hmasteractive; - $scope.hmasterstandby = hmasterstandby; - }) + + $q.all(regionArray).then(function (res) { + + for(var i=0; i +
+
+

+ +

+
+
+
+ + + + + + + + + + + + + + + + + +
MasterRackSiteIdStatus
+ {{item.tags.hostname}} + {{item.tags.rack}}{{item.tags.site}} + {{item.status}} +
+
+
+
http://git-wip-us.apache.org/repos/asf/eagle/blob/1550c895/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html ---------------------------------------------------------------------- diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html index 13caebf..f58ab21 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html +++ b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html @@ -20,36 +20,33 @@

- Service Summary Information + HBase Service Summary Information

- - - - - - +
RegionServer Status - {{regiontotal}} RegionServers - {{regionhealtynum}} Healthy - {{regiontotal - regionhealtynum}} UnHealthy -
+ + + + + - - - + + + + + - - - + + + + + -
{{hmasteractivenum}}Active HBase Master{{regionsnum}}Regions +
Active Hmaster Status - ({{hmasteractive.tags.hostname}}) Healthy - ({{hmasteractive.tags.hostname}}) Healthy -
{{hmasterstandbynum}}Backup HBase Master{{hmasteraverageload}}Average Load
Standby Hmaster Status - ({{hmasterstandby.tags.hostname}}) Healthy - ({{hmasterstandby.tags.hostname}}) Healthy -
{{regionservertotal}}RegionServers: {{regionserverhealtynum}} Good Health / {{regionservertotal-regionserverhealtynum}} + Bad Health +
http://git-wip-us.apache.org/repos/asf/eagle/blob/1550c895/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css ---------------------------------------------------------------------- diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css index 6ae1ea1..4f2298c 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css +++ b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css @@ -64,3 +64,17 @@ color: #fff; } +.small-box.hadoopMetric-widget { + margin: 0; + height: 100%; + min-height: 110px; +} + +.hadoopMetric-widget-detail { + margin-left: 12px; + margin-top: 10px; +} + +.hadoopMetric-table { + text-align: right; +} http://git-wip-us.apache.org/repos/asf/eagle/blob/1550c895/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js ---------------------------------------------------------------------- diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js index 75e6835..48a139a 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js +++ b/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js @@ -27,61 +27,100 @@ Yarn: 'green', }; - var widgetChartOption = { - color: ['#FFFFFF'], - grid: { - top: 0, - right: 0, - bottom: 0, - left: 0, - containLabel: false, - }, - xAxis: { - axisLine: {show: false}, - axisLabel: {show: false}, - }, - yAxis: [{ - axisLine: {show: false}, - axisLabel: {show: false}, - axisTick: {show: false}, - splitLine: {show: false}, - }], - }; - hadoopMetricApp.directive("hadoopMetricWidget", function () { return { restrict: 'AE', - controller: function($scope, $attrs) { + controller: function ($scope, $attrs, METRIC, Application, $interval, Site, $wrapState) { // Get site var site = $scope.site; + var refreshInterval; + if(!site) { + $scope.list = $.map(Application.find("HADOOP_METRIC_MONITOR"), function (app) { + return { + siteId: app.site.siteId, + siteName: app.site.siteName || app.site.siteId, + count: -1 + }; + }); + } else { + $scope.list = [{ + siteId: site.siteId, + siteName: site.siteName || site.siteId, + count: -1 + }]; + } // Get type $scope.type = $attrs.type; // Customize chart color $scope.bgColor = COLOR_MAPPING[$scope.type]; - $scope.chartOption = widgetChartOption; - // Mock fetch data - var now = +new Date(); - var data = []; - for(var j = 0 ; j < 30 ; j += 1) { - data.push({x: now + j * 1000 * 60, y: Math.random() * 100}); + // Ref: jpm widget if need keep refresh the widget + + function refresh() { + $.each($scope.list, function (i, site) { + var hbaseservers = METRIC.hbasehostStatus({site: site.siteName}); + hbaseservers._promise.then(function (res) { + var hmasternum = 0; + var hmasteractivenum = 0; + var regionserverHealthynum = 0; + var regionservertotal = 0; + $.each(res, function (i, server) { + var role = server.tags.role; + var status = server.status; + if (role === "hmaster") { + hmasternum++; + if (status === "active") { + hmasteractivenum++; + } + } else if (role === "regionserver") { + regionservertotal++; + if (status === "live") { + regionserverHealthynum++; + } + } + }); + $scope.hbaseinfo = { + hmasternum: hmasternum, + hmasteractivenum: hmasteractivenum, + regionserverHealthynum: regionserverHealthynum, + regionservertotal: regionservertotal + }; + }); + }); } - $scope.series = [{ - name: '', - type: 'line', - data: data, - showSymbol: false, - }]; - // Ref: jpm widget if need keep refresh the widget + refresh(); + refreshInterval = $interval(refresh, 30 * 1000); + + $scope.$on('$destroy', function () { + $interval.cancel(refreshInterval); + }); }, template: - '
' + - '

{{type}}

' + - '
' + + '', replace: true }; @@ -99,9 +138,7 @@ ); }; } - - hadoopMetricApp.widget("availabilityHDFSChart", withType('HDFS'), true); hadoopMetricApp.widget("availabilityHBaseChart", withType('HBase'), true); - hadoopMetricApp.widget("availabilityYarnChart", withType('Yarn'), true); }); })(); +//# sourceURL=availabilityChart.js