diff --git a/README.md b/README.md
index 5f521c8..ffac083 100644
--- a/README.md
+++ b/README.md
@@ -112,7 +112,6 @@ http://hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/ResourceManag
#### ClusterMetrics
#### Nodes
#### SchedulerInfo
-#### Apps
#### AggregatedApps
Metrics under AggregatedApps are aggregated metrics from all running and recently finished apps. To specify the period for which metrics are gathered, set `aggregateAppPeriod` in config.yml.
@@ -203,7 +202,7 @@ Custom Dashboard
Contributing
------------
-Always feel free to fork and contribute any changes directly via GitHub.
+Always feel free to fork and contribute any changes directly here on GitHub.
Community
diff --git a/src/main/java/com/appdynamics/monitors/hadoop/HadoopMonitor.java b/src/main/java/com/appdynamics/monitors/hadoop/HadoopMonitor.java
index e5865b1..26fb2b6 100755
--- a/src/main/java/com/appdynamics/monitors/hadoop/HadoopMonitor.java
+++ b/src/main/java/com/appdynamics/monitors/hadoop/HadoopMonitor.java
@@ -108,34 +108,33 @@ private boolean determineIfHadoopHasResourceManger(String hadoopVersion) {
}
private void printResourceManagerMetrics(String metricPathPrefix, Map hadoopMetrics) {
- try {
- for (Map.Entry entry : hadoopMetrics.entrySet()) {
- printMetric(metricPathPrefix + entry.getKey(), entry.getValue());
- }
- } catch (Exception e) {
- logger.error("Error printing ResourceManager Metrics: ", e);
+ for (Map.Entry entry : hadoopMetrics.entrySet()) {
+ printMetric(metricPathPrefix + entry.getKey(), entry.getValue());
}
}
private void printAmbariMetrics(String metricPathPrefix, Map ambariMetrics) {
- try {
- for (Map.Entry entry : ambariMetrics.entrySet()) {
- printMetric(metricPathPrefix + entry.getKey(), entry.getValue());
- }
- } catch (Exception e) {
- logger.error("Error printing Ambari Metrics: ", e);
+ for (Map.Entry entry : ambariMetrics.entrySet()) {
+ printMetric(metricPathPrefix + entry.getKey(), entry.getValue());
}
}
private void printMetric(String metricName, Object metricValue) {
- MetricWriter metricWriter = getMetricWriter(metricName,
- MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE,
- MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE,
- MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL
- );
- if (metricValue != null && metricValue instanceof Number) {
- String value = MetricUtils.toWholeNumberString(metricValue);
- metricWriter.printMetric(value);
+ try {
+ MetricWriter metricWriter = getMetricWriter(metricName,
+ MetricWriter.METRIC_AGGREGATION_TYPE_AVERAGE,
+ MetricWriter.METRIC_TIME_ROLLUP_TYPE_AVERAGE,
+ MetricWriter.METRIC_CLUSTER_ROLLUP_TYPE_INDIVIDUAL
+ );
+ if (metricValue != null && metricValue instanceof Number) {
+ String value = MetricUtils.toWholeNumberString(metricValue);
+ metricWriter.printMetric(value);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Metric: " + metricName + " value: "+ metricValue+" -> " + value);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Exception while printing the metric: " + metricName + " value: "+ metricValue, e);
}
}
diff --git a/src/main/java/com/appdynamics/monitors/hadoop/communicator/AmbariCommunicator.java b/src/main/java/com/appdynamics/monitors/hadoop/communicator/AmbariCommunicator.java
index 4bdf0c8..b777dab 100755
--- a/src/main/java/com/appdynamics/monitors/hadoop/communicator/AmbariCommunicator.java
+++ b/src/main/java/com/appdynamics/monitors/hadoop/communicator/AmbariCommunicator.java
@@ -101,7 +101,7 @@ public Map fetchAmbariMetrics() throws AmbariMonitorException {
if (httpClient != null) {
httpClient.close();
}
- if (executor != null) {
+ if (executor != null && !executor.isShutdown()) {
executor.shutdown();
}
}
diff --git a/src/main/java/com/appdynamics/monitors/hadoop/communicator/HadoopCommunicator.java b/src/main/java/com/appdynamics/monitors/hadoop/communicator/HadoopCommunicator.java
index 4da7223..c1696f0 100755
--- a/src/main/java/com/appdynamics/monitors/hadoop/communicator/HadoopCommunicator.java
+++ b/src/main/java/com/appdynamics/monitors/hadoop/communicator/HadoopCommunicator.java
@@ -64,7 +64,8 @@ public void populate(Map metrics) {
getClusterMetrics();
getClusterScheduler();
getAggrApps();
- getApplicationMetrics();
+ // Added for RBC but then ignoring as there were lot of auto-generated apps which were causing instability to Controller
+ // getApplicationMetrics();
getClusterNodes();
}
@@ -315,6 +316,7 @@ private void getApplicationMetrics() {
for (Map app : appList) {
String appName = (String) app.get("name");
+
String metricPath = "Apps|" + appName + "|";
if (app.get("finishedTime") != null) {
metrics.put(metricPath + "finishedTime", app.get("finishedTime"));
@@ -329,6 +331,8 @@ private void getApplicationMetrics() {
metrics.put(metricPath + "runningContainers", app.get("runningContainers"));
metrics.put(metricPath + "memorySeconds", app.get("memorySeconds"));
metrics.put(metricPath + "vcoreSeconds", app.get("vcoreSeconds"));
+ String appState = (String) app.get("state");
+ metrics.put(metricPath + "state", AppState.valueOf(appState).ordinal());
}
}
} catch (Exception e) {
@@ -390,6 +394,6 @@ private Map getNode(Map node, String hierarchy)
}
private enum AppState {
- NEW, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED
+ NEW, NEW_SAVING, SUBMITTED, ACCEPTED, RUNNING, FINISHED, FAILED, KILLED
}
}