Repository: incubator-eagle
Updated Branches:
  refs/heads/master d394a8e34 -> a641aca15


EAGLE-186 Support hadoop.namenode.fsnamesystemstate.capacityusage and fix 
resource manager metric bug

https://issues.apache.org/jira/browse/EAGLE-186

Sign-off: Hao Chen <h...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/a641aca1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/a641aca1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/a641aca1

Branch: refs/heads/master
Commit: a641aca155531edaf4e6ab843d6aa2c7f4eff022
Parents: d394a8e
Author: Hao Chen <h...@apache.org>
Authored: Fri Mar 4 09:52:01 2016 -0800
Committer: Hao Chen <h...@apache.org>
Committed: Fri Mar 4 09:52:01 2016 -0800

----------------------------------------------------------------------
 eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py |  2 +-
 eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py  | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a641aca1/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
----------------------------------------------------------------------
diff --git a/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py 
b/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
index 2a5096b..c33b327 100644
--- a/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
+++ b/eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
@@ -86,7 +86,7 @@ class HadoopRMHAChecker(MetricCollector):
         total_count = len(hosts)
 
         self.collect({
-            "component": "namenode",
+            "component": "resourcemanager",
             "metric": "hadoop.resourcemanager.hastate.total.count",
             "value": total_count
         })

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a641aca1/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
----------------------------------------------------------------------
diff --git a/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py 
b/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
index 8837c30..286d0be 100644
--- a/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
+++ b/eagle-external/hadoop_jmx_collector/hadoop_jmx_kafka.py
@@ -56,6 +56,14 @@ class MemortUsageMetric(JmxMetricListener):
             self.collector.on_bean_kv(self.PREFIX, "memheapcommittedusage", 
memheapcommittedusage)
 
 
+class NNCapacityUsageMetric(JmxMetricListener):
+    PREFIX = "hadoop.namenode.fsnamesystemstate"
+
+    def on_bean(self, bean):
+        if bean["name"] == "Hadoop:service=NameNode,name=FSNamesystemState":
+            capacityusage = round(float(bean['CapacityUsed']) / 
float(bean['CapacityTotal']) * 100, 2)
+            self.collector.on_bean_kv(self.PREFIX, "capacityusage", 
capacityusage)
+
 class JournalTransactionInfoMetric(JmxMetricListener):
     PREFIX = "hadoop.namenode.journaltransaction"
 
@@ -74,6 +82,7 @@ if __name__ == '__main__':
             NNSafeModeMetric(),
             NNHAMetric(),
             MemortUsageMetric(),
-            JournalTransactionInfoMetric()
+            JournalTransactionInfoMetric(),
+            NNCapacityUsageMetric()
     )
     Runner.run(collector)

Reply via email to