You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/09/18 16:44:11 UTC
[22/34] git commit: AMBARI-7374. Slider View: BE - Provide alerts in
view API. Correcting component counts
AMBARI-7374. Slider View: BE - Provide alerts in view API. Correcting component counts
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/00589244
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/00589244
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/00589244
Branch: refs/heads/branch-alerts-dev
Commit: 0058924443bee9cb4b55afade3bfa08196765308
Parents: c7651de
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Wed Sep 17 21:00:46 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Wed Sep 17 21:00:46 2014 -0700
----------------------------------------------------------------------
.../ambari/view/slider/SliderAppsAlerts.java | 30 ++++++++++++--------
.../slider/SliderAppsViewControllerImpl.java | 8 ++++++
.../assets/data/resource/service_configs.json | 2 +-
.../createAppWizard/step1_controller.js | 2 +-
.../ui/app/templates/slider_app/summary.hbs | 2 +-
5 files changed, 29 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/00589244/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsAlerts.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsAlerts.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsAlerts.java
index 957c6e8..4eb54d5 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsAlerts.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsAlerts.java
@@ -66,8 +66,23 @@ public class SliderAppsAlerts {
HashMap<AlertField,Object> alertItem = new HashMap<AlertField, Object>();
Date date = Calendar.getInstance().getTime();
-
- AlertState state = getComponentState(component);
+ int totalContainerCount = component.getInstanceCount();
+ int activeContainerCount = component.getActiveContainers() != null ? component
+ .getActiveContainers().size() : 0;
+ AlertState state = AlertState.UNKNOWN;
+ String message = String.format("%s out of %s active", activeContainerCount,
+ totalContainerCount);
+ if (totalContainerCount == activeContainerCount || totalContainerCount < 1) {
+ // Everything OK
+ state = AlertState.OK;
+ } else {
+ float fraction = (float) activeContainerCount / (float) totalContainerCount;
+ if (fraction <= 0.2) { // less than or equal to 20%
+ state = AlertState.WARNING;
+ } else {
+ state = AlertState.CRITICAL;
+ }
+ }
alertItem.put(AlertField.description, String.format("%s component",component.getComponentName()));
alertItem.put(AlertField.host_name, getComponentHostName(component));
alertItem.put(AlertField.last_status, state);
@@ -78,7 +93,7 @@ public class SliderAppsAlerts {
alertItem.put(AlertField.component_name, component.getComponentName());
alertItem.put(AlertField.status, state);
alertItem.put(AlertField.status_time, new java.sql.Timestamp(date.getTime()));
- alertItem.put(AlertField.output, state);
+ alertItem.put(AlertField.output, message);
alertItem.put(AlertField.actual_status, state);
return alertItem;
}
@@ -108,13 +123,4 @@ public class SliderAppsAlerts {
}
return null;
}
-
- private AlertState getComponentState(SliderAppComponent component){
- if (component.getInstanceCount() == component.getActiveContainers().size()){
- return AlertState.OK;
- }
- return AlertState.CRITICAL;
- }
-
-
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/00589244/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index 027f824..ef11cfa 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -319,9 +319,17 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
containerId, containerDataMap);
}
}
+ // Set total instances count from statistics
appComponent.setInstanceCount(appComponent
.getActiveContainers().size()
+ appComponent.getCompletedContainers().size());
+ if (description.statistics != null
+ && description.statistics.containsKey(componentEntry.getKey())) {
+ Map<String, Integer> statisticsMap = description.statistics.get(componentEntry.getKey());
+ if (statisticsMap.containsKey("containers.desired")) {
+ appComponent.setInstanceCount(statisticsMap.get("containers.desired"));
+ }
+ }
}
}
app.setAlerts(sliderAlerts.generateComponentsAlerts(componentTypeMap, app.getType()));
http://git-wip-us.apache.org/repos/asf/ambari/blob/00589244/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/service_configs.json
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/service_configs.json b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/service_configs.json
index f255bec..24c1a31 100644
--- a/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/service_configs.json
+++ b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/service_configs.json
@@ -19,7 +19,7 @@
"rrdcached_flush_timeout" : "7200",
"gmond_user" : "nobody",
"ganglia_runtime_dir" : "/var/run/ganglia/hdp",
- "ganglia_custom_clusters": "'HBaseCluster1','7000','AccumuloCluster1','7001','HBaseCluster2','7002'"
+ "additional_clusters": "'HBaseCluster1','7000','AccumuloCluster1','7001','HBaseCluster2','7002'"
},
"properties_attributes" : { }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/00589244/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
index 9ffc432..8583443 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/createAppWizard/step1_controller.js
@@ -141,7 +141,7 @@ App.CreateAppWizardStep1Controller = Ember.Controller.extend({
var gangliaCustomClusters = [];
if (data.items[0]) {
- var prop = Em.get(data.items[0].configurations[0].properties, 'ganglia_custom_clusters');
+ var prop = Em.get(data.items[0].configurations[0].properties, 'additional_clusters');
if (prop) {
//parse CSV string with cluster names and ports
prop.replace(/\'/g, "").split(',').forEach(function(item, index){
http://git-wip-us.apache.org/repos/asf/ambari/blob/00589244/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
index 68d47b4..ae056a6 100644
--- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs
@@ -90,7 +90,7 @@
<div class="col-md-11">
<div class="row">
<div class="col-md-7 title">{{title}}</div>
- <div {{bs-bind-tooltip view.tooltip}} data-placement="right" class="col-md-5 date-time">{{timeSinceAlert}}</div>
+ <div {{bs-bind-tooltip view.tooltip}} data-placement="left" class="col-md-5 date-time">{{timeSinceAlert}}</div>
</div>
<div class="message">{{message}}</div>
</div>