From 237d96fa25b99cf94087c4033fde11a0e7e3e346 Mon Sep 17 00:00:00 2001 From: chitin Date: Fri, 17 Feb 2017 19:02:54 +0800 Subject: [PATCH 1/4] refactor hadoop metric --- .../eagle/metric/HadoopMetricMonitorApp.java | 80 ++++++------- .../HadoopMetricMonitorAppProdiver.java | 0 ....metric.HadoopMetricMonitorAppProdiver.xml | 0 ...g.apache.eagle.app.spi.ApplicationProvider | 0 .../src/main/resources/datasources.json | 0 .../src/main/resources/policies.json | 0 .../src/main/resources/publishments.json | 0 .../src/main/resources/streamdefinitions.json | 0 .../app/apps/hadoop_metric/.editorconfig | 0 .../webapp/app/apps/hadoop_metric/config.json | 0 .../ctrls/backupMasterListCtrl.js | 0 .../app/apps/hadoop_metric/ctrls/hdfs.js | 54 ++++----- .../app/apps/hadoop_metric/ctrls/overview.js | 0 .../hadoop_metric/ctrls/regionDetailCtrl.js | 0 .../hadoop_metric/ctrls/regionListCtrl.js | 0 .../webapp/app/apps/hadoop_metric/index.js | 0 .../partials/backupMasterList.html | 0 .../hadoop_metric/partials/hdfs/index.html | 38 +++--- .../apps/hadoop_metric/partials/overview.html | 0 .../partials/region/regionDetail.html | 0 .../partials/region/regionList.html | 0 .../app/apps/hadoop_metric/style/index.css | 0 .../widgets/availabilityChart.js | 0 .../src/main/webapp/app/apps/index.html | 0 .../metric/HadoopMetricMonitorAppDebug.java | 44 +++---- .../HadoopMetricMonitorAppProviderTest.java | 0 .../eagle/metric/SendSampleDataToKafka.java | 112 +++++++++--------- .../src/test/resources/application.conf | 96 +++++++-------- .../resources/hadoop_jmx_metric_sample.json | 14 +-- .../test/resources/integrate_test_policy.json | 72 +++++------ {eagle-hadoop-metric => eagle-metric}/pom.xml | 8 +- pom.xml | 2 +- 32 files changed, 263 insertions(+), 257 deletions(-) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java (97%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorAppProdiver.java (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/datasources.json (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/policies.json (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/publishments.json (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/resources/streamdefinitions.json (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/.editorconfig (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/config.json (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js (97%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/index.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html (97%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/partials/overview.html (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/style/index.css (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/main/webapp/app/apps/index.html (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java (97%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppProviderTest.java (100%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java (97%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/resources/application.conf (96%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/resources/hadoop_jmx_metric_sample.json (95%) rename {eagle-hadoop-metric => eagle-metric/eagle-hadoop-metric}/src/test/resources/integrate_test_policy.json (97%) rename {eagle-hadoop-metric => eagle-metric}/pom.xml (93%) diff --git a/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java b/eagle-metric/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java similarity index 97% rename from eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java rename to eagle-metric/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java index 5aa27a3b9b..304e500864 100644 --- a/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java +++ b/eagle-metric/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorApp.java @@ -1,41 +1,41 @@ -/* - * 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. - */ -package org.apache.eagle.metric; - -import backtype.storm.generated.StormTopology; -import com.typesafe.config.Config; -import org.apache.eagle.app.StormApplication; -import org.apache.eagle.app.environment.builder.MetricDefinition; -import org.apache.eagle.app.environment.impl.StormEnvironment; - -import java.util.Calendar; - -public class HadoopMetricMonitorApp extends StormApplication { - @Override - public StormTopology execute(Config config, StormEnvironment environment) { - return environment.newApp(config) - .fromStream("HADOOP_JMX_METRIC_STREAM") - .saveAsMetric(MetricDefinition - .metricType("HADOOP_JMX_METRICS") - .namedByField("metric") - .eventTimeByField("timestamp") - .dimensionFields("host","component","site") - .granularity(Calendar.MINUTE) - .valueField("value")) - .toTopology(); - } +/* + * 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. + */ +package org.apache.eagle.metric; + +import backtype.storm.generated.StormTopology; +import com.typesafe.config.Config; +import org.apache.eagle.app.StormApplication; +import org.apache.eagle.app.environment.builder.MetricDefinition; +import org.apache.eagle.app.environment.impl.StormEnvironment; + +import java.util.Calendar; + +public class HadoopMetricMonitorApp extends StormApplication { + @Override + public StormTopology execute(Config config, StormEnvironment environment) { + return environment.newApp(config) + .fromStream("HADOOP_JMX_METRIC_STREAM") + .saveAsMetric(MetricDefinition + .metricType("HADOOP_JMX_METRICS") + .namedByField("metric") + .eventTimeByField("timestamp") + .dimensionFields("host","component","site") + .granularity(Calendar.MINUTE) + .valueField("value")) + .toTopology(); + } } \ No newline at end of file diff --git a/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorAppProdiver.java b/eagle-metric/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorAppProdiver.java similarity index 100% rename from eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorAppProdiver.java rename to eagle-metric/eagle-hadoop-metric/src/main/java/org/apache/eagle/metric/HadoopMetricMonitorAppProdiver.java diff --git a/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml b/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml similarity index 100% rename from eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml rename to eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml diff --git a/eagle-hadoop-metric/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider similarity index 100% rename from eagle-hadoop-metric/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider rename to eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider diff --git a/eagle-hadoop-metric/src/main/resources/datasources.json b/eagle-metric/eagle-hadoop-metric/src/main/resources/datasources.json similarity index 100% rename from eagle-hadoop-metric/src/main/resources/datasources.json rename to eagle-metric/eagle-hadoop-metric/src/main/resources/datasources.json diff --git a/eagle-hadoop-metric/src/main/resources/policies.json b/eagle-metric/eagle-hadoop-metric/src/main/resources/policies.json similarity index 100% rename from eagle-hadoop-metric/src/main/resources/policies.json rename to eagle-metric/eagle-hadoop-metric/src/main/resources/policies.json diff --git a/eagle-hadoop-metric/src/main/resources/publishments.json b/eagle-metric/eagle-hadoop-metric/src/main/resources/publishments.json similarity index 100% rename from eagle-hadoop-metric/src/main/resources/publishments.json rename to eagle-metric/eagle-hadoop-metric/src/main/resources/publishments.json diff --git a/eagle-hadoop-metric/src/main/resources/streamdefinitions.json b/eagle-metric/eagle-hadoop-metric/src/main/resources/streamdefinitions.json similarity index 100% rename from eagle-hadoop-metric/src/main/resources/streamdefinitions.json rename to eagle-metric/eagle-hadoop-metric/src/main/resources/streamdefinitions.json diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js rename to eagle-metric/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/hdfs.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js similarity index 97% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js index 74bb7bfbaa..7b974cf4f1 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js +++ b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js @@ -1,28 +1,28 @@ -/* - * 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("hdfsCtrl", function ($scope, PageConfig) { - PageConfig.title = 'HDFS'; - }); - }); +/* + * 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("hdfsCtrl", function ($scope, PageConfig) { + PageConfig.title = 'HDFS'; + }); + }); })(); \ No newline at end of file diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js rename to eagle-metric/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/regionDetailCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html similarity index 97% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html index 33acb15bd2..3c85f07f71 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html +++ b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html @@ -1,19 +1,19 @@ - - -HDFS Page + + +HDFS Page diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html rename to eagle-metric/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/region/regionDetail.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css rename to eagle-metric/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/widgets/availabilityChart.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/index.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/index.html rename to eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html diff --git a/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java b/eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java similarity index 97% rename from eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java rename to eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java index 03ba4eeddf..e4589b79e2 100644 --- a/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java +++ b/eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppDebug.java @@ -1,23 +1,23 @@ -/* - * 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. - */ -package org.apache.eagle.metric; - -public class HadoopMetricMonitorAppDebug { - public static void main(String[] args) { - new HadoopMetricMonitorApp().run(args); - } +/* + * 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. + */ +package org.apache.eagle.metric; + +public class HadoopMetricMonitorAppDebug { + public static void main(String[] args) { + new HadoopMetricMonitorApp().run(args); + } } \ No newline at end of file diff --git a/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppProviderTest.java b/eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppProviderTest.java similarity index 100% rename from eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppProviderTest.java rename to eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/HadoopMetricMonitorAppProviderTest.java diff --git a/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java b/eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java similarity index 97% rename from eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java rename to eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java index 026f60be7d..c53dfe31d1 100644 --- a/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java +++ b/eagle-metric/eagle-hadoop-metric/src/test/java/org/apache/eagle/metric/SendSampleDataToKafka.java @@ -1,56 +1,56 @@ -/* - * 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. - */ -package org.apache.eagle.metric; - -import com.typesafe.config.ConfigFactory; -import kafka.producer.KeyedMessage; -import kafka.producer.ProducerConfig; -import org.apache.eagle.app.messaging.KafkaStreamProvider; -import org.apache.eagle.app.messaging.KafkaStreamSinkConfig; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.Properties; - -public class SendSampleDataToKafka { - public static void main(String[] args) throws URISyntaxException, IOException { - String data = "{" + - "\"host\":\"localhost\", " + - "\"timestamp\": 1480319109000, " + - "\"metric\": \"hadoop.cpu.usage\", " + - "\"component\": \"namenode\", " + - "\"site\": \"test\", " + - "\"value\": 0.98}"; - KafkaStreamSinkConfig config = new KafkaStreamProvider().getSinkConfig("HADOOP_JMX_METRIC_STREAM",ConfigFactory.load()); - Properties properties = new Properties(); - properties.put("metadata.broker.list", config.getBrokerList()); - properties.put("serializer.class", config.getSerializerClass()); - properties.put("key.serializer.class", config.getKeySerializerClass()); - // new added properties for async producer - properties.put("producer.type", config.getProducerType()); - properties.put("batch.num.messages", config.getNumBatchMessages()); - properties.put("request.required.acks", config.getRequestRequiredAcks()); - properties.put("queue.buffering.max.ms", config.getMaxQueueBufferMs()); - ProducerConfig producerConfig = new ProducerConfig(properties); - kafka.javaapi.producer.Producer producer = new kafka.javaapi.producer.Producer(producerConfig); - try { - producer.send(new KeyedMessage(config.getTopicId(), data)); - } finally { - producer.close(); - } - } -} +/* + * 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. + */ +package org.apache.eagle.metric; + +import com.typesafe.config.ConfigFactory; +import kafka.producer.KeyedMessage; +import kafka.producer.ProducerConfig; +import org.apache.eagle.app.messaging.KafkaStreamProvider; +import org.apache.eagle.app.messaging.KafkaStreamSinkConfig; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.util.Properties; + +public class SendSampleDataToKafka { + public static void main(String[] args) throws URISyntaxException, IOException { + String data = "{" + + "\"host\":\"localhost\", " + + "\"timestamp\": 1480319109000, " + + "\"metric\": \"hadoop.cpu.usage\", " + + "\"component\": \"namenode\", " + + "\"site\": \"test\", " + + "\"value\": 0.98}"; + KafkaStreamSinkConfig config = new KafkaStreamProvider().getSinkConfig("HADOOP_JMX_METRIC_STREAM",ConfigFactory.load()); + Properties properties = new Properties(); + properties.put("metadata.broker.list", config.getBrokerList()); + properties.put("serializer.class", config.getSerializerClass()); + properties.put("key.serializer.class", config.getKeySerializerClass()); + // new added properties for async producer + properties.put("producer.type", config.getProducerType()); + properties.put("batch.num.messages", config.getNumBatchMessages()); + properties.put("request.required.acks", config.getRequestRequiredAcks()); + properties.put("queue.buffering.max.ms", config.getMaxQueueBufferMs()); + ProducerConfig producerConfig = new ProducerConfig(properties); + kafka.javaapi.producer.Producer producer = new kafka.javaapi.producer.Producer(producerConfig); + try { + producer.send(new KeyedMessage(config.getTopicId(), data)); + } finally { + producer.close(); + } + } +} diff --git a/eagle-hadoop-metric/src/test/resources/application.conf b/eagle-metric/eagle-hadoop-metric/src/test/resources/application.conf similarity index 96% rename from eagle-hadoop-metric/src/test/resources/application.conf rename to eagle-metric/eagle-hadoop-metric/src/test/resources/application.conf index 8ff60165d4..4d74666ba9 100644 --- a/eagle-hadoop-metric/src/test/resources/application.conf +++ b/eagle-metric/eagle-hadoop-metric/src/test/resources/application.conf @@ -1,49 +1,49 @@ -# 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. - - - - -{ - service { - env = "testing" - host = "localhost" - port = 9090 - username = "admin" - password = "secret" - readTimeOutSeconds = 60 - context = "/rest" - timezone = "UTC" - } - - "appId" : "HadoopJmxAppForTest", - "mode" : "LOCAL", - "siteId" : "testsite", - "dataSourceConfig": { - "topic" : "hadoop_jmx_metric", - "zkConnection" : "localhost:2181", - "txZkServers" : "localhost:2181" - } - "dataSinkConfig": { - "topic" : "hadoop_jmx_metric", - "brokerList" : "localhost:6667", - "serializerClass" : "kafka.serializer.StringEncoder", - "keySerializerClass" : "kafka.serializer.StringEncoder" - "producerType" : "async", - "numBatchMessages" : "4096", - "maxQueueBufferMs" : "5000", - "requestRequiredAcks" : "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. + + + + +{ + service { + env = "testing" + host = "localhost" + port = 9090 + username = "admin" + password = "secret" + readTimeOutSeconds = 60 + context = "/rest" + timezone = "UTC" + } + + "appId" : "HadoopJmxAppForTest", + "mode" : "LOCAL", + "siteId" : "testsite", + "dataSourceConfig": { + "topic" : "hadoop_jmx_metric", + "zkConnection" : "localhost:2181", + "txZkServers" : "localhost:2181" + } + "dataSinkConfig": { + "topic" : "hadoop_jmx_metric", + "brokerList" : "localhost:6667", + "serializerClass" : "kafka.serializer.StringEncoder", + "keySerializerClass" : "kafka.serializer.StringEncoder" + "producerType" : "async", + "numBatchMessages" : "4096", + "maxQueueBufferMs" : "5000", + "requestRequiredAcks" : "0" + } } \ No newline at end of file diff --git a/eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json b/eagle-metric/eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json similarity index 95% rename from eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json rename to eagle-metric/eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json index 68472a0a86..74852d0e0c 100644 --- a/eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json +++ b/eagle-metric/eagle-hadoop-metric/src/test/resources/hadoop_jmx_metric_sample.json @@ -1,8 +1,8 @@ -{ - "host":"localhost", - "timestamp": 1480319107000, - "metric": "hadoop.cpu.usage", - "component": "namenode", - "site": "test", - "value": 0.96 +{ + "host":"localhost", + "timestamp": 1480319107000, + "metric": "hadoop.cpu.usage", + "component": "namenode", + "site": "test", + "value": 0.96 } \ No newline at end of file diff --git a/eagle-hadoop-metric/src/test/resources/integrate_test_policy.json b/eagle-metric/eagle-hadoop-metric/src/test/resources/integrate_test_policy.json similarity index 97% rename from eagle-hadoop-metric/src/test/resources/integrate_test_policy.json rename to eagle-metric/eagle-hadoop-metric/src/test/resources/integrate_test_policy.json index e9de11c778..5146ffacbc 100644 --- a/eagle-hadoop-metric/src/test/resources/integrate_test_policy.json +++ b/eagle-metric/eagle-hadoop-metric/src/test/resources/integrate_test_policy.json @@ -1,37 +1,37 @@ -{ - "name": "TEST_POLICY", - "description": "from HADOOP_JMX_METRIC_STREAM_SANDBOX[site==\"test\"] insert into ALERT_STREAM;", - "inputStreams": [ - "HADOOP_JMX_METRIC_STREAM_SANDBOX" - ], - "outputStreams": [ - "ALERT_STREAM" - ], - "definition": { - "type": "siddhi", - "value": "from HADOOP_JMX_METRIC_STREAM_SANDBOX[site==\"test\"] select component,value, name insert into ALERT_STREAM;", - "handlerClass": null, - "properties": {}, - "inputStreams": [], - "outputStreams": [] - }, - "stateDefinition": null, - "policyStatus": "ENABLED", - "alertDefinition": { - "templateType": "TEXT", - "subject": "$component Disk Usage $value", - "body": "#set($usage_percentage = $value * 100)\r\n\r\nDisk Usage ($metric) reached $usage_percentage % (Threshold: 90%) on $component of cluster: $site on:\r\n

", - "severity": "CRITICAL", - "category": "HDFS" - }, - "partitionSpec": [ - { - "streamId": "HADOOP_JMX_METRIC_STREAM_SANDBOX", - "type": "SHUFFLE", - "columns": [], - "sortSpec": null - } - ], - "dedicated": false, - "parallelismHint": 5 +{ + "name": "TEST_POLICY", + "description": "from HADOOP_JMX_METRIC_STREAM_SANDBOX[site==\"test\"] insert into ALERT_STREAM;", + "inputStreams": [ + "HADOOP_JMX_METRIC_STREAM_SANDBOX" + ], + "outputStreams": [ + "ALERT_STREAM" + ], + "definition": { + "type": "siddhi", + "value": "from HADOOP_JMX_METRIC_STREAM_SANDBOX[site==\"test\"] select component,value, name insert into ALERT_STREAM;", + "handlerClass": null, + "properties": {}, + "inputStreams": [], + "outputStreams": [] + }, + "stateDefinition": null, + "policyStatus": "ENABLED", + "alertDefinition": { + "templateType": "TEXT", + "subject": "$component Disk Usage $value", + "body": "#set($usage_percentage = $value * 100)\r\n\r\nDisk Usage ($metric) reached $usage_percentage % (Threshold: 90%) on $component of cluster: $site on:\r\n
    \r\n
  • Hostname: $host
  • \r\n
  • When: $ALERT_TIME
  • \r\n
  • Root Cause: UNKNOWN
  • \r\n
  • Action Required: N/A
  • \r\n
", + "severity": "CRITICAL", + "category": "HDFS" + }, + "partitionSpec": [ + { + "streamId": "HADOOP_JMX_METRIC_STREAM_SANDBOX", + "type": "SHUFFLE", + "columns": [], + "sortSpec": null + } + ], + "dedicated": false, + "parallelismHint": 5 } \ No newline at end of file diff --git a/eagle-hadoop-metric/pom.xml b/eagle-metric/pom.xml similarity index 93% rename from eagle-hadoop-metric/pom.xml rename to eagle-metric/pom.xml index 0677f3bd99..2732464a43 100644 --- a/eagle-hadoop-metric/pom.xml +++ b/eagle-metric/pom.xml @@ -23,8 +23,14 @@ 4.0.0 - eagle-hadoop-metric + eagle-metric-parent Eagle::App::HadoopMetric + pom + + eagle-hadoop-metric + eagle-hdfs-web + + org.apache.eagle diff --git a/pom.xml b/pom.xml index a47309f56a..daa24a21c0 100755 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ eagle-topology-assembly eagle-examples eagle-gc - eagle-hadoop-metric + eagle-metric eagle-server eagle-jpm eagle-server-assembly From 8a5a66e335565230c78fa329e46bd7b8c79341a4 Mon Sep 17 00:00:00 2001 From: chitin Date: Fri, 17 Feb 2017 19:10:46 +0800 Subject: [PATCH 2/4] add hdfs web app --- eagle-metric/eagle-hadoop-metric/pom.xml | 58 +++++++++++++++++++ eagle-metric/eagle-hdfs-web/pom.xml | 58 +++++++++++++++++++ .../app/hdfs/HdfsWebApplicationProvider.java | 23 ++++++++ ...le.app.hdfs.HdfsWebApplicationProvider.xml | 46 +++++++++++++++ ...g.apache.eagle.app.spi.ApplicationProvider | 16 +++++ .../main/webapp/app/apps/hdfs/.editorconfig | 27 +++++++++ .../webapp/app/apps/hdfs/ctrls/overview.js | 29 ++++++++++ .../src/main/webapp/app/apps/hdfs/index.js | 40 +++++++++++++ .../app/apps/hdfs/partials/overview.html | 17 ++++++ .../src/main/webapp/package.json | 0 10 files changed, 314 insertions(+) create mode 100644 eagle-metric/eagle-hadoop-metric/pom.xml create mode 100644 eagle-metric/eagle-hdfs-web/pom.xml create mode 100644 eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/app/hdfs/HdfsWebApplicationProvider.java create mode 100644 eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.app.hdfs.HdfsWebApplicationProvider.xml create mode 100644 eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrls/overview.js create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/package.json diff --git a/eagle-metric/eagle-hadoop-metric/pom.xml b/eagle-metric/eagle-hadoop-metric/pom.xml new file mode 100644 index 0000000000..b2a73cbcea --- /dev/null +++ b/eagle-metric/eagle-hadoop-metric/pom.xml @@ -0,0 +1,58 @@ + + + + + eagle-metric-parent + org.apache.eagle + 0.5.0-SNAPSHOT + + 4.0.0 + eagle-hadoop-metric + Eagle::App::HadoopMetric::Hdfs::WebUI + + + org.apache.eagle + eagle-app-base + ${project.version} + + + + org.apache.eagle + eagle-jpm-mr-running + ${project.version} + test + + + org.apache.eagle + eagle-jpm-mr-history + ${project.version} + test + + + + + + src/main/webapp/app + assets/ + + + src/main/resources + + + + \ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/pom.xml b/eagle-metric/eagle-hdfs-web/pom.xml new file mode 100644 index 0000000000..2dbc8917b5 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/pom.xml @@ -0,0 +1,58 @@ + + + + + eagle-metric-parent + org.apache.eagle + 0.5.0-SNAPSHOT + + 4.0.0 + eagle-hdfs-web + Eagle::App::HadoopMetric::Hdfs::WebUI + + + org.apache.eagle + eagle-app-base + ${project.version} + + + + org.apache.eagle + eagle-jpm-mr-running + ${project.version} + test + + + org.apache.eagle + eagle-jpm-mr-history + ${project.version} + test + + + + + + src/main/webapp/app + assets/ + + + src/main/resources + + + + \ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/app/hdfs/HdfsWebApplicationProvider.java b/eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/app/hdfs/HdfsWebApplicationProvider.java new file mode 100644 index 0000000000..b41f4d9f3a --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/app/hdfs/HdfsWebApplicationProvider.java @@ -0,0 +1,23 @@ +/* + * 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. + */ +package org.apache.eagle.app.hdfs; + +import org.apache.eagle.app.StaticApplicationProvider; + +public class HdfsWebApplicationProvider extends StaticApplicationProvider { + // HdfsWebApplicationProvider SPI Interface +} \ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.app.hdfs.HdfsWebApplicationProvider.xml b/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.app.hdfs.HdfsWebApplicationProvider.xml new file mode 100644 index 0000000000..b6f70d1118 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.app.hdfs.HdfsWebApplicationProvider.xml @@ -0,0 +1,46 @@ + + + + + HDFS_METRIC_WEB_APP + Hdfs Metric Monitoring Web + /apps/hdfs + Hdfs Metric Monitoring Web + + + HADOOP_METRIC_MONITOR + true + + + TOPOLOGY_HEALTH_CHECK_APP + true + + + + + service.host + Eagle Service Host + Set additional eagle service host, default: using current host + + + service.port + Eagle Service Port + Set additional eagle service port, default: using current port + + + \ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider new file mode 100644 index 0000000000..8ad6b0c67d --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider @@ -0,0 +1,16 @@ +# 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. + +org.apache.eagle.app.hdfs.HdfsWebApplicationProvider \ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig new file mode 100644 index 0000000000..42a9b6997c --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig @@ -0,0 +1,27 @@ +# 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. + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_style = tab +indent_size = 4 + +[*.md] +trim_trailing_whitespace = false diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrls/overview.js b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrls/overview.js new file mode 100644 index 0000000000..3299a9a91d --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrls/overview.js @@ -0,0 +1,29 @@ +/* + * 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("overviewCtrl", function (PageConfig) { + PageConfig.title = 'Hdfs'; + + }); + }); +})(); diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js new file mode 100644 index 0000000000..6772c40f4b --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js @@ -0,0 +1,40 @@ +/* + * 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` is global function that for application to set up 'controller', 'service', 'directive', 'route' in Eagle + */ + var hadoopMetricApp = register(['ngRoute', 'ngAnimate', 'ui.router', 'eagle.service']); + + hadoopMetricApp.route("HadoopMetric_HDFS", { + url: "/hadoopService/hdfs", + site: true, + templateUrl: "partials/overview.html", + controller: "overviewCtrl", + resolve: {time: true} + }); + + hadoopMetricApp.portal({ + name: "Services", icon: "heartbeat", list: [ + {name: "HDFS", path: "hadoopService/hdfs"} + ] + }, true); + + hadoopMetricApp.require("ctrls/overview.js"); +})(); diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html new file mode 100644 index 0000000000..678b221aec --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html @@ -0,0 +1,17 @@ + + +HDFS Page diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/package.json b/eagle-metric/eagle-hdfs-web/src/main/webapp/package.json new file mode 100644 index 0000000000..e69de29bb2 From 985c3fdbade596a33d108670aff5260486f0638b Mon Sep 17 00:00:00 2001 From: chitin Date: Mon, 20 Feb 2017 13:26:17 +0800 Subject: [PATCH 3/4] [EAGLE-900] Only show left navigation item (HDFS, HBase) when we install the JMX application - Refactor eagle-hadoop-metric to single app for every service, for example, there is a eagle-hadoop-metric before, but eagle-hadoop-metric is split into eagle-hadoop-metric, eagle-hdfs-metric and eagle-hbase-metric, we can see HBase navigation item only if we install eagle-hbase-metric. https://issues.apache.org/jira/browse/EAGLE-900 --- ....metric.HadoopMetricMonitorAppProdiver.xml | 7 - .../app/apps/hadoop_metric/.editorconfig | 27 -- .../webapp/app/apps/hadoop_metric/config.json | 68 ---- .../ctrls/backupMasterListCtrl.js | 35 -- .../app/apps/hadoop_metric/ctrls/hdfs.js | 28 -- .../app/apps/hadoop_metric/ctrls/overview.js | 298 ---------------- .../hadoop_metric/ctrls/regionDetailCtrl.js | 286 --------------- .../hadoop_metric/ctrls/regionListCtrl.js | 38 -- .../webapp/app/apps/hadoop_metric/index.js | 337 ------------------ .../partials/backupMasterList.html | 52 --- .../hadoop_metric/partials/hdfs/index.html | 19 - .../apps/hadoop_metric/partials/overview.html | 111 ------ .../partials/region/regionDetail.html | 117 ------ .../partials/region/regionList.html | 53 --- .../widgets/availabilityChart.js | 145 -------- .../src/main/webapp/app/apps/index.html | 6 - eagle-metric/eagle-hdfs-web/pom.xml | 5 +- .../HdfsMetricWebApplicationProvider.java} | 4 +- ...tric.HdfsMetricWebApplicationProvider.xml} | 0 ...g.apache.eagle.app.spi.ApplicationProvider | 2 +- .../app/apps/hdfs/{ctrls => ctrl}/overview.js | 0 .../src/main/webapp/app/apps/hdfs/index.html | 6 + .../src/main/webapp/app/apps/hdfs/index.js | 4 +- .../webapp/app/apps/hdfs}/style/index.css | 2 +- .../app/apps/hdfs/widget/availabilityChart.js | 107 ++++++ .../HdfsMetricWebApplicationProviderTest.java | 88 +++++ eagle-metric/pom.xml | 12 - eagle-server/pom.xml | 6 + .../org/apache/eagle/server/ServerDebug.java | 2 +- .../src/test/resources/configuration.yml | 4 +- ...g.apache.eagle.app.spi.ApplicationProvider | 5 +- 31 files changed, 223 insertions(+), 1651 deletions(-) delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js delete mode 100644 eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html rename eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/{app/hdfs/HdfsWebApplicationProvider.java => metric/HdfsMetricWebApplicationProvider.java} (88%) rename eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/{org.apache.eagle.app.hdfs.HdfsWebApplicationProvider.xml => org.apache.eagle.metric.HdfsMetricWebApplicationProvider.xml} (100%) rename eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/{ctrls => ctrl}/overview.js (100%) create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.html rename eagle-metric/{eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-hdfs-web/src/main/webapp/app/apps/hdfs}/style/index.css (99%) create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/widget/availabilityChart.js create mode 100644 eagle-metric/eagle-hdfs-web/src/test/HdfsMetricWebApplicationProviderTest.java diff --git a/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml b/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml index 8262da9a59..9c34b1f22d 100644 --- a/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml +++ b/eagle-metric/eagle-hadoop-metric/src/main/resources/META-INF/providers/org.apache.eagle.metric.HadoopMetricMonitorAppProdiver.xml @@ -19,13 +19,6 @@ HADOOP_METRIC_MONITOR Hadoop Metrics Monitor - /apps/hadoop_metric - - - TOPOLOGY_HEALTH_CHECK_APP - true - - diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig deleted file mode 100644 index 42a9b6997c..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig +++ /dev/null @@ -1,27 +0,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. - -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = tab -indent_size = 4 - -[*.md] -trim_trailing_whitespace = false diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json deleted file mode 100644 index 88b14f6e32..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "master": { - "nonheap": "hadoop.memory.nonheapmemoryusage.used", - "heap": "hadoop.memory.heapmemoryusage.used", - "averageload": "hadoop.hbase.master.server.averageload", - "ritcount": "hadoop.hbase.master.assignmentmanger.ritcount", - "ritcountoverthreshold": "hadoop.hbase.master.assignmentmanger.ritcountoverthreshold", - "AssignNumOps": "hadoop.hbase.master.assignmentmanger.assign_num_ops", - "AssignMin": "hadoop.hbase.master.assignmentmanger.assign_min", - "AssignMax": "hadoop.hbase.master.assignmentmanger.assign_max", - "AssignPercentile75th": "hadoop.hbase.master.assignmentmanger.assign_75th_percentile", - "AssignPercentile95th": "hadoop.hbase.master.assignmentmanger.assign_95th_percentile", - "AssignPercentile99th": "hadoop.hbase.master.assignmentmanger.assign_99th_percentile", - "BulkAssignNum_ops": "hadoop.hbase.master.assignmentmanger.bulkassign_num_ops", - "BulkAssignMin": "hadoop.hbase.master.assignmentmanger.bulkassign_min", - "BulkAssignMax": "hadoop.hbase.master.assignmentmanger.bulkassign_max", - "BulkAssignPercentile75th": "hadoop.hbase.master.assignmentmanger.bulkassign_75th_percentile", - "BulkAssignPercentile95th": "hadoop.hbase.master.assignmentmanger.bulkassign_95th_percentile", - "BulkAssignPercentile99th": "hadoop.hbase.master.assignmentmanger.bulkassign_99th_percentile", - "BalancerClusterNum_ops": "hadoop.hbase.master.balancer.balancercluster_num_ops", - "BalancerClusterMin": "hadoop.hbase.master.balancer.balancercluster_min", - "BalancerClusterMax": "hadoop.hbase.master.balancer.balancercluster_max", - "BalancerClusterPercentile75th": "hadoop.hbase.master.balancer.balancercluster_75th_percentile", - "BalancerClusterPercentile95th": "hadoop.hbase.master.balancer.balancercluster_95th_percentile", - "BalancerClusterPercentile99th": "hadoop.hbase.master.balancer.balancercluster_99th_percentile", - "HlogSplitTimeMin": "hadoop.hbase.master.filesystem.hlogsplittime_min", - "HlogSplitTimeMax": "hadoop.hbase.master.filesystem.hlogsplittime_max", - "HlogSplitTimePercentile75th": "hadoop.hbase.master.filesystem.hlogsplittime_75th_percentile", - "HlogSplitTimePercentile95th": "hadoop.hbase.master.filesystem.hlogsplittime_95th_percentile", - "HlogSplitTimePercentile99th": "hadoop.hbase.master.filesystem.hlogsplittime_99th_percentile", - "HlogSplitSizeMin": "hadoop.hbase.master.filesystem.hlogsplitsize_min", - "HlogSplitSizeMax": "hadoop.hbase.master.filesystem.hlogsplitsize_max", - "MetaHlogSplitTimeMin": "hadoop.hbase.master.filesystem.metahlogsplittime_min", - "MetaHlogSplitTimeMax": "hadoop.hbase.master.filesystem.metahlogsplittime_max", - "MetaHlogSplitTimePercentile75th": "hadoop.hbase.master.filesystem.metahlogsplittime_75th_percentile", - "MetaHlogSplitTimePercentile95th": "hadoop.hbase.master.filesystem.metahlogsplittime_95th_percentile", - "MetaHlogSplitTimePercentile99th": "hadoop.hbase.master.filesystem.metahlogsplittime_99th_percentile", - "MetaHlogSplitSizeMin": "hadoop.hbase.master.filesystem.metahlogsplitsize_min", - "MetaHlogSplitSizeMax": "hadoop.hbase.master.filesystem.metahlogsplitsize_max" - }, - "regionserver": { - "nonheap" : "hadoop.memory.nonheapmemoryusage.used", - "heap" : "hadoop.memory.heapmemoryusage.used", - "directmemory" : "hadoop.bufferpool.direct.memoryused", - "GCCount" : "hadoop.hbase.jvm.gccount", - "GCTimeMillis" : "hadoop.hbase.jvm.gctimemillis", - "QueueSize" : "hadoop.hbase.regionserver.ipc.queuesize", - "NumCallsInGeneralQueue" : "hadoop.hbase.regionserver.ipc.numcallsingeneralqueue", - "NumActiveHandler" : "hadoop.hbase.regionserver.ipc.numactivehandler", - "IPCQueueTime99th" : "hadoop.hbase.regionserver.ipc.queuecalltime_99th_percentile", - "IPCProcessTime99th" : "hadoop.hbase.regionserver.ipc.processcalltime_99th_percentile", - "QueueCallTime_num_ops" : "hadoop.hbase.regionserver.ipc.queuecalltime_num_ops", - "ProcessCallTime_num_ops" : "hadoop.hbase.regionserver.ipc.processcalltime_num_ops", - "RegionCount" : "hadoop.hbase.regionserver.server.regioncount", - "StoreCount" : "hadoop.hbase.regionserver.server.storecount", - "MemStoreSize" : "hadoop.hbase.regionserver.server.memstoresize", - "StoreFileSize" : "hadoop.hbase.regionserver.server.storefilesize", - "TotalRequestCount" : "hadoop.hbase.regionserver.server.totalrequestcount", - "ReadRequestCount" : "hadoop.hbase.regionserver.server.readrequestcount", - "WriteRequestCount" : "hadoop.hbase.regionserver.server.writerequestcount", - "SlitQueueLength" : "hadoop.hbase.regionserver.server.splitqueuelength", - "CompactionQueueLength" : "hadoop.hbase.regionserver.server.compactionqueuelength", - "FlushQueueLength" : "hadoop.hbase.regionserver.server.flushqueuelength", - "BlockCacheSize" : "hadoop.hbase.regionserver.server.blockcachesize", - "BlockCacheHitCount" : "hadoop.hbase.regionserver.server.blockcachehitcount", - "BlockCacheCountHitPercent" : "hadoop.hbase.regionserver.server.blockcounthitpercent" - } -} diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js deleted file mode 100644 index ca6c47ee81..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js +++ /dev/null @@ -1,35 +0,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. - */ - -(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.tableScope = {}; - $scope.site = $wrapState.param.siteId; - $scope.searchPathList = [["tags", "hostname"], ["tags", "rack"], ["tags", "site"], ["status"]]; - $scope.backupMasterList = METRIC.hbaseMaster($scope.site, "standby", 1000); - }); - }); -})(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js deleted file mode 100644 index 7b974cf4f1..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js +++ /dev/null @@ -1,28 +0,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. - */ - -(function () { - /** - * `register` without params will load the module which using require - */ - register(function (hadoopMetricApp) { - hadoopMetricApp.controller("hdfsCtrl", function ($scope, PageConfig) { - PageConfig.title = 'HDFS'; - }); - }); -})(); \ No newline at end of file diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js deleted file mode 100644 index 6e7df0bc4e..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js +++ /dev/null @@ -1,298 +0,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. - */ - -(function () { - /** - * `register` without params will load the module which using require - */ - register(function (hadoopMetricApp) { - hadoopMetricApp.controller("overviewCtrl", function ($q, $wrapState, $scope, PageConfig, METRIC, Time) { - var cache = {}; - $scope.site = $wrapState.param.siteId; - var activeMasterInfo = METRIC.hbaseMaster($scope.site, "active", 1); - - PageConfig.title = 'HBase'; - var storageOption = { - animation: false, - tooltip: { - formatter: function (points) { - return points[0].name + "
" + - $.map(points, function (point) { - return ' ' + - point.seriesName + ": " + - common.number.abbr(point.value, true, 0); - }).reverse().join("
"); - } - }, - yAxis: [{ - axisLabel: { - formatter: function (value) { - return common.number.abbr(value, true); - } - } - }] - }; - - - function generateHbaseMetric(name, flag) { - var startTime = Time.startTime(); - var endTime = Time.endTime(); - var interval = Time.diffInterval(startTime, endTime); - var intervalMin = interval / 1000 / 60; - var trendStartTime = Time.align(startTime, interval); - var trendEndTime = Time.align(endTime, interval); - - $scope.site = $wrapState.param.siteId; - var result = cache[name] || activeMasterInfo._promise.then(function (res) { - var hostname = cache[hostname] = cache[hostname] || res[0].tags.hostname; - $scope.defaultHostname = $wrapState.param.hostname || hostname; - - var jobCond = { - site: $scope.site, - component: "hbasemaster", - host: $scope.defaultHostname - }; - return METRIC.aggMetricsToEntities(METRIC.hbaseMetricsAggregation(jobCond, name, ["site"], "avg(value)", intervalMin, trendStartTime, trendEndTime), flag) - ._promise.then(function (list) { - var metricFlag = $.map(list, function (metrics) { - return metrics[0].flag; - }); - return [metricFlag, list]; - }); - }); - return result; - } - - function mergeMetricToOneSeries(metricTitle, metrics, legendName, dataOption, option) { - var series = []; - - $.each(metrics, function (i, metricMap) { - if (typeof metricMap !== 'undefined') { - series.push(METRIC.metricsToSeries(legendName[i], metricMap[0], option)); - } - }); - return { - title: metricTitle, - series: series, - option: dataOption || {}, - loading: false - }; - } - - function countHBaseRole(site, status, role, groups, filed, limit) { - var jobCond = { - site: site, - status: status, - role: role - }; - return METRIC.aggHBaseInstance(jobCond, groups, filed, limit); - } - - function sumAllRegions(site, role, groups, filed, limit) { - var jobCond = { - site: site, - role: role - }; - return METRIC.aggHBaseInstance(jobCond, groups, filed, limit); - } - - // TODO: Optimize the chart count - // TODO: ECharts dynamic refresh series bug: https://github.com/ecomfe/echarts/issues/4033 - $scope.chartList = [ - { - name: "MemoryUsage", - metrics: ["nonheap", "heap"], - linename: ["nonheap", "heap"], - option: storageOption - }, - { - name: "Master Averageload", - metrics: ["averageload"], - linename: ["averageload"], - option: {} - }, - { - name: "Ritcount", - metrics: ["ritcount", "ritcountoverthreshold"], - linename: ["ritcount", "ritcountoverthreshold"], - option: {} - }, - { - name: "AssignOpsNum", - metrics: ["AssignNumOps"], - linename: ["numOps"], - option: {} - }, - { - name: "Assign", - metrics: ["AssignMin", "AssignMax", "AssignPercentile75th", "AssignPercentile95th", "AssignPercentile99th"], - linename: ["min", "max", "75th", "95th", "99th"], - option: {} - }, - { - name: "BulkAssignOpsNum", - metrics: ["BulkAssignNum_ops"], - linename: ["num_ops"], - option: {} - }, - { - name: "BulkAssign", - metrics: ["BulkAssignMin", "BulkAssignMax", "BulkAssignPercentile75th", "BulkAssignPercentile95th", "BulkAssignPercentile99th"], - linename: ["min", "max", "75th", "95th", "99th"], - option: {} - }, - { - name: "BalancerClusterOpsNum", - metrics: ["BalancerClusterNum_ops"], - linename: ["num_ops"], - option: {} - }, - { - name: "BalancerCluster", - metrics: ["BalancerClusterMin", "BalancerClusterMax", "BalancerClusterPercentile75th", "BalancerClusterPercentile95th", "BalancerClusterPercentile99th"], - linename: ["min", "max", "75th", "95th", "99th"], - option: {} - }, - { - name: "HlogSplitTime", - metrics: ["HlogSplitTimeMin", "HlogSplitTimeMax"], - linename: ["HlogSplitTime_min", "HlogSplitTime_max"], - option: {} - }, - { - name: "HlogSplitTime Percentile", - metrics: ["HlogSplitTimePercentile75th", "HlogSplitTimePercentile95th", "HlogSplitTimePercentile99th"], - linename: ["75th", "95th", "99th"], - option: {} - }, - { - name: "HlogSplitSize", - metrics: ["HlogSplitSizeMin","HlogSplitSizeMax"], - linename: ["Min", "Max"], - option: {} - }, - { - name: "MetaHlogSplitTime", - metrics: ["MetaHlogSplitTimeMin", "MetaHlogSplitTimeMax"], - linename: ["Min", "Max"], - option: {} - }, - { - name: "MetaHlogSplitTime Percentile", - metrics: ["MetaHlogSplitTimePercentile75th", "MetaHlogSplitTimePercentile95th", "MetaHlogSplitTimePercentile99th"], - linename: ["75th", "95th", "99th"], - option: {} - }, - { - name: "MetaHlogSplitSize", - metrics: ["MetaHlogSplitSizeMin", "MetaHlogSplitSizeMax"], - linename: ["Min", "Max"], - option: {} - } - ]; - $scope.metricList = []; - $.each($scope.chartList, function (i) { - var chart = $scope.chartList[i]; - var chartname = chart.name; - $scope.metricList[chartname] = { - title: chartname, - series: {}, - option: {}, - loading: true, - promises: [] - }; - }); - $scope.refresh = function () { - - METRIC.getMetricObj().then(function (res) { - var masterMetricList = res.master; - $.each($scope.chartList, function (i) { - var chart = $scope.chartList[i]; - var metricList = chart.metrics; - $.each(metricList, function (j) { - var metricKey = metricList[j]; - var metricspromies = generateHbaseMetric(masterMetricList[metricKey], metricKey); - var chartname = chart.name; - $scope.metricList[chartname].promises.push(metricspromies); - }); - }); - - $.each($scope.chartList, function (k) { - var chart = $scope.chartList[k]; - var chartname = chart.name; - $q.all($scope.metricList[chartname].promises).then(function (resp) { - var series = []; - for (var r = 0; r < resp.length; r += 1) { - var rs = resp[r][1]; - if (rs.length > 0) { - series.push(rs); - } - } - $scope.metricList[chartname] = mergeMetricToOneSeries(chartname, series, chart.linename, chart.option); - }); - }); - }); - - countHBaseRole($scope.site, "active", "hmaster", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.hmasteractivenum = data.value[0]; - }); - }); - countHBaseRole($scope.site, "standby", "hmaster", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.hmasterstandbynum = data.value[0]; - }); - }); - - countHBaseRole($scope.site, "live", "regionserver", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.regionserverhealtynum = data.value[0]; - }); - }); - countHBaseRole($scope.site, "dead", "regionserver", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.regionserverunhealtynum = data.value[0]; - }); - }); - sumAllRegions($scope.site, "regionserver", ["site"], "sum(numRegions)")._promise.then(function (res) { - $.map(res, function (data) { - $scope.regionsnum = data.value[0]; - }); - }); - - activeMasterInfo._promise.then(function (res) { - var hostname = cache[hostname] = cache[hostname] || res[0].tags.hostname; - $scope.defaultHostname = $wrapState.param.hostname || hostname; - var jobCond = { - site: $scope.site, - component: "hbasemaster", - host: $scope.defaultHostname - }; - METRIC.hbaseMomentMetric(jobCond, "hadoop.hbase.master.server.averageload", 1).then(function (res) { - $scope.hmasteraverageload = (typeof res.data.obj[0] !== 'undefined') ? res.data.obj[0].value[0] : "-1"; - }); - }); - }; - Time.onReload(function () { - cache = {}; - $scope.refresh(); - }, $scope); - $scope.refresh(); - }); - }); -})(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js deleted file mode 100644 index 42d5367067..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js +++ /dev/null @@ -1,286 +0,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. - */ - -(function () { - /** - * `register` without params will load the module which using require - */ - register(function (hadoopMetricApp) { - hadoopMetricApp.controller("regionDetailCtrl", function ($q, $wrapState, $scope, PageConfig, Time, METRIC) { - var cache = {}; - $scope.site = $wrapState.param.siteId; - $scope.hostname = $wrapState.param.hostname; - PageConfig.title = 'RegionServer ' + "(" + $scope.hostname + ")"; - Time.autoRefresh = false; - - var sizeoption = { - animation: false, - tooltip: { - formatter: function (points) { - return points[0].name + "
" + - $.map(points, function (point) { - return ' ' + - point.seriesName + ": " + - common.number.abbr(point.value, true); - }).reverse().join("
"); - } - }, - legend: { - x: 'center', y: 'bottom' - }, - areaStyle: {normal: {}}, - yAxis: [{ - axisLabel: { - formatter: function (value) { - return common.number.abbr(value, true); - } - } - }] - }; - - var gctimeoption = { - legend: { - x: 'center', y: 'bottom' - }, - yAxis: [{ - axisLabel: { - formatter: function (value) { - return value / 1000 + ' S'; - } - } - }] - }; - $scope.chartList = [ - { - name: "Memory Usage", - metrics: ["nonheap", "heap"], - option: sizeoption - }, - { - name: "Direct Memory Usage", - metrics: ["directmemory"], - option: sizeoption - }, - { - name: "GC count", - metrics: ["GCCount"], - option: {} - }, - { - name: "GC TimeMillis", - metrics: ["GCTimeMillis"], - option: gctimeoption - }, - { - name: "QueueSize", - metrics: ["QueueSize"], - option: {} - }, - { - name: "NumCallsInGeneralQueue", - metrics: ["NumCallsInGeneralQueue"], - option: {} - }, - { - name: "NumActiveHandler", - metrics: ["NumActiveHandler"], - option: {} - }, - { - name: "IPC Queue Time (99th)", - metrics: ["IPCQueueTime99th"], - option: {} - }, - { - name: "IPC Process Time (99th)", - metrics: ["IPCProcessTime99th"], - option: {} - }, - { - name: "QueueCallTime_num_ops", - metrics: ["QueueCallTime_num_ops"], - option: {} - }, - { - name: "ProcessCallTime_num_ops", - metrics: ["ProcessCallTime_num_ops"], - option: {} - }, - { - name: "RegionCount", - metrics: ["RegionCount"], - option: {} - }, - { - name: "StoreCount", - metrics: ["StoreCount"], - option: {} - }, - { - name: "MemStoreSize", - metrics: ["MemStoreSize"], - option: sizeoption - }, - { - name: "StoreFileSize", - metrics: ["StoreFileSize"], - option: sizeoption - }, - { - name: "TotalRequestCount", - metrics: ["TotalRequestCount"], - option: {} - }, - { - name: "ReadRequestCount", - metrics: ["ReadRequestCount"], - option: {} - }, - { - name: "WriteRequestCount", - metrics: ["WriteRequestCount"], - option: {} - }, - { - name: "SlitQueueLength", - metrics: ["SlitQueueLength"], - option: {} - }, - { - name: "CompactionQueueLength", - metrics: ["CompactionQueueLength"], - option: {} - }, - { - name: "FlushQueueLength", - metrics: ["FlushQueueLength"], - option: {} - }, - { - name: "BlockCacheSize", - metrics: ["BlockCacheSize"], - option: sizeoption - }, - { - name: "BlockCacheHitCount", - metrics: ["BlockCacheHitCount"], - option: {} - }, - { - name: "BlockCacheCountHitPercent", - metrics: ["BlockCacheCountHitPercent"], - option: {} - } - ]; - - $scope.metricList = []; - $.each($scope.chartList, function (i) { - var chart = $scope.chartList[i]; - var chartname = chart.name; - $scope.metricList[chartname] = { - title: chartname, - series: {}, - option: {}, - loading: true, - promises: [] - }; - }); - $scope.refresh = function () { - var startTime = Time.startTime(); - var endTime = Time.endTime(); - - METRIC.getMetricObj().then(function (res) { - var masterMetricList = res.regionserver; - $.each($scope.chartList, function (i) { - var chart = $scope.chartList[i]; - var metricList = chart.metrics; - $.each(metricList, function (j) { - var metricKey = metricList[j]; - var metricspromies = generateHbaseMetric(masterMetricList[metricKey], startTime, endTime, metricKey); - var chartname = chart.name; - $scope.metricList[chartname].promises.push(metricspromies); - }); - }); - - $.each($scope.chartList, function (k) { - var chart = $scope.chartList[k]; - var chartname = chart.name; - $q.all($scope.metricList[chartname].promises).then(function (resp) { - var series = []; - for (var r = 0; r < resp.length; r += 1) { - var rs = resp[r][1]; - if (rs.length > 0) { - series.push(rs); - } - } - $scope.metricList[chartname] = mergeSeries(chartname, series, chart.metrics, chart.option); - }); - }); - }); - - METRIC.regionserverStatus($scope.hostname, $scope.site)._promise.then(function (res) { - $scope.regionstatus = res; - }); - }; - Time.onReload(function () { - cache = {}; - $scope.refresh(); - }, $scope); - $scope.refresh(); - - - function generateHbaseMetric(name, startTime, endTime, flag) { - var interval = Time.diffInterval(startTime, endTime); - var intervalMin = interval / 1000 / 60; - var trendStartTime = Time.align(startTime, interval); - var trendEndTime = Time.align(endTime, interval); - - var condition = { - site: $scope.site, - component: "regionserver", - host: $scope.hostname - }; - return METRIC.aggMetricsToEntities(METRIC.hbaseMetricsAggregation(condition, name, ["site"], "avg(value)", intervalMin, trendStartTime, trendEndTime), flag) - ._promise.then(function (list) { - var metricFlag = $.map(list, function (metrics) { - return metrics[0].flag; - }); - return [metricFlag, list]; - }); - } - - function mergeSeries(title, metrics, linename, option) { - var series = []; - $.each(metrics, function (i, metricMap) { - $.map(metricMap, function (metric) { - if (typeof metric !== 'undefined') { - series.push(METRIC.metricsToSeries(linename[i], metric, option)); - } - }); - }); - return { - title: title, - series: series, - option: option || {}, - loading: false - }; - } - }); - }); -}) -(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js deleted file mode 100644 index 1477e32a6c..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js +++ /dev/null @@ -1,38 +0,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. - */ - -(function () { - /** - * `register` without params will load the module which using require - */ - register(function (hadoopMetricApp) { - - hadoopMetricApp.controller("regionListCtrl", function ($wrapState, $scope, PageConfig, METRIC) { - - // Initialization - PageConfig.title = "HBASE RegionServers"; - $scope.tableScope = {}; - $scope.live = METRIC.STATUS_LIVE; - $scope.dead = METRIC.STATUS_DEAD; - $scope.site = $wrapState.param.siteId; - $scope.searchPathList = [["tags", "hostname"], ["tags", "rack"], ["tags", "site"], ["status"]]; - $scope.regionserverList = METRIC.regionserverList($scope.site); - - }); - }); -})(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js deleted file mode 100644 index d4789b2796..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js +++ /dev/null @@ -1,337 +0,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. - */ - -(function () { - /** - * `register` is global function that for application to set up 'controller', 'service', 'directive', 'route' in Eagle - */ - var hadoopMetricApp = register(['ngRoute', 'ngAnimate', 'ui.router', 'eagle.service']); - - hadoopMetricApp.route("HadoopMetric", { - url: "/hadoopService/HBase/overview?startTime&endTime", - site: true, - templateUrl: "partials/overview.html", - controller: "overviewCtrl", - resolve: {time: true} - }).route("HadoopMetric_HDFS", { - url: "/hadoopService/hdfs", - site: true, - templateUrl: "partials/hdfs/index.html", - controller: "hdfsCtrl", - resolve: {time: true} - }).route("regionDetail", { - url: "/hadoopService/HBase/regionDetail/:hostname", - site: true, - templateUrl: "partials/region/regionDetail.html", - controller: "regionDetailCtrl", - resolve: {time: true} - }).route("regionList", { - url: "/hadoopService/HBase/regionList", - site: true, - templateUrl: "partials/region/regionList.html", - controller: "regionListCtrl" - }).route("backupMasterList", { - url: "/hadoopService/HBase/backupMasterList", - site: true, - templateUrl: "partials/backupMasterList.html", - controller: "backupMasterListCtrl" - }).route("masterDetail", { - url: "/hadoopService/HBase/:hostname?startTime&endTime", - site: true, - reloadOnSearch: false, - templateUrl: "partials/overview.html", - controller: "overviewCtrl", - resolve: {time: true} - }); - - hadoopMetricApp.portal({ - name: "Services", icon: "heartbeat", list: [ - {name: "HBase", path: "hadoopService/HBase/overview"}, - {name: "HDFS", path: "hadoopService/hdfs"} - ] - }, true); - - hadoopMetricApp.service("METRIC", function ($q, $http, Time, Site, Application) { - var METRIC = window._METRIC = {}; - METRIC.STATUS_LIVE = "live"; - METRIC.STATUS_DEAD = "dead"; - METRIC.QUERY_HBASE_METRICS = '${baseURL}/rest/entities?query=GenericMetricService[${condition}]{*}&metricName=${metric}&pageSize=${limit}'; - METRIC.QUERY_HBASE_METRICS_WITHTIME = '${baseURL}/rest/entities?query=GenericMetricService[${condition}]{*}&metricName=${metric}&pageSize=${limit}&startTime=${startTime}&endTime=${endTime}'; - METRIC.QUERY_HBASE_INSTANCE = '${baseURL}/rest/entities?query=HbaseServiceInstance[${condition}]{*}&pageSize=${limit}'; - METRIC.QUERY_HBASE_INSTANCE_AGG = "${baseURL}/rest/entities?query=HbaseServiceInstance[${condition}]<${groups}>{${field}}&pageSize=${limit}"; - METRIC.QUERY_HBASE_METRICS_INTERVAL = '${baseURL}/rest/entities?query=GenericMetricService[${condition}]<${groups}>{${field}}${order}${top}&metricName=${metric}&pageSize=${limit}&startTime=${startTime}&endTime=${endTime}&intervalmin=${intervalMin}&timeSeries=true'; - /** - * Fetch query content with current site application configuration - * @param {string} queryName - */ - var getQuery = METRIC.getQuery = function (queryName, siteId) { - var baseURL; - siteId = siteId || Site.current().siteId; - var app = Application.find("HADOOP_METRIC_MONITOR", siteId)[0]; - var host = app.configuration["service.host"]; - var port = app.configuration["service.port"]; - - if (!host && !port) { - baseURL = ""; - } else { - if (host === "localhost" || !host) { - host = location.hostname; - } - if (!port) { - port = location.port; - } - baseURL = "http://" + host + ":" + port; - } - - return common.template(METRIC["QUERY_" + queryName], {baseURL: baseURL}); - }; - - function wrapList(promise) { - var _list = []; - _list._done = false; - - _list._promise = promise.then( - /** - * @param {{}} res - * @param {{}} res.data - * @param {{}} res.data.obj - */ - function (res) { - _list.splice(0); - Array.prototype.push.apply(_list, res.data.obj); - _list._done = true; - return _list; - }); - return _list; - } - - function toFields(fields) { - return (fields || []).length > 0 ? $.map(fields, function (field) { - return "@" + field; - }).join(",") : "*"; - } - - METRIC.metricsToSeries = function (name, metrics, option, rawData) { - if (arguments.length === 4 && typeof rawData === "object") { - option = rawData; - rawData = false; - } - - var data = $.map(metrics, function (metric) { - return rawData ? metric.value[0] : { - x: metric.timestamp, - y: metric.value[0] - }; - }); - return $.extend({ - name: name, - showSymbol: false, - type: "line", - data: data - }, option || {}); - }; - - METRIC.get = function (url, params) { - return $http({ - url: url, - method: "GET", - params: params - }); - }; - - METRIC.condition = function (condition) { - return $.map(condition, function (value, key) { - return "@" + key + '="' + value + '"'; - }).join(" AND "); - }; - - - METRIC.hbaseMetrics = function (condition, metric, startTime, endTime, limit) { - var config = { - condition: METRIC.condition(condition), - startTime: Time.format(startTime), - endTime: Time.format(endTime), - metric: metric, - limit: limit || 10000 - }; - - var metrics_url = common.template(getQuery("HBASE_METRICS_WITHTIME"), config); - return wrapList(METRIC.get(metrics_url)); - }; - - METRIC.hbaseMomentMetric = function (condition, metric, limit) { - var config = { - condition: METRIC.condition(condition), - metric: metric, - limit: limit || 10000 - }; - - var metrics_url = common.template(getQuery("HBASE_METRICS"), config); - return METRIC.get(metrics_url); - }; - - METRIC.aggHBaseInstance = function (condition, groups, field, limit) { - var fields = field.split(/\s*,\s*/); - var fieldStr = $.map(fields, function (field, index) { - var matches = field.match(/^([^\s]*)(\s+.*)?$/); - if (matches[2]) { - orderId = index; - } - return matches[1]; - }).join(", "); - var config = { - condition: METRIC.condition(condition), - groups: toFields(groups), - field: fieldStr, - limit: limit || 10000 - }; - var metrics_url = common.template(getQuery("HBASE_INSTANCE_AGG"), config); - return wrapList(METRIC.get(metrics_url)); - }; - - METRIC.hbaseMetricsAggregation = function (condition, metric, groups, field, intervalMin, startTime, endTime, top, limit) { - var fields = field.split(/\s*,\s*/); - var orderId = -1; - var fieldStr = $.map(fields, function (field, index) { - var matches = field.match(/^([^\s]*)(\s+.*)?$/); - if (matches[2]) { - orderId = index; - } - return matches[1]; - }).join(", "); - - - var config = { - condition: METRIC.condition(condition), - startTime: Time.format(startTime), - endTime: Time.format(endTime), - metric: metric, - groups: toFields(groups), - field: fieldStr, - order: orderId === -1 ? "" : ".{" + fields[orderId] + "}", - top: top ? "&top=" + top : "", - intervalMin: intervalMin, - limit: limit || 10000 - }; - - var metrics_url = common.template(getQuery("HBASE_METRICS_INTERVAL"), config); - var _list = wrapList(METRIC.get(metrics_url)); - _list._aggInfo = { - groups: groups, - startTime: Time(startTime).valueOf(), - interval: intervalMin * 60 * 1000 - }; - _list._promise.then(function () { - _list.reverse(); - }); - return _list; - }; - - METRIC.aggMetricsToEntities = function (list, param, flatten) { - var _list = []; - _list.done = false; - _list._promise = list._promise.then(function () { - var _startTime = list._aggInfo.startTime; - var _interval = list._aggInfo.interval; - - $.each(list, function (i, obj) { - var tags = {}; - $.each(list._aggInfo.groups, function (j, group) { - tags[group] = obj.key[j]; - }); - - var _subList = $.map(obj.value[0], function (value, index) { - return { - timestamp: _startTime + index * _interval, - value: [value], - tags: tags, - flag: param - }; - }); - - if (flatten) { - _list.push.apply(_list, _subList); - } else { - _list.push(_subList); - } - }); - _list.done = true; - return _list; - }); - return _list; - }; - - - METRIC.hbasehostStatus = function (condition, limit) { - var config = { - condition: METRIC.condition(condition), - limit: limit || 10000 - }; - - var metrics_url = common.template(getQuery("HBASE_INSTANCE"), config); - return wrapList(METRIC.get(metrics_url)); - }; - - METRIC.hbaseMaster = function (siteId, status, limit) { - var condition = { - site: siteId, - role: "hmaster", - status: status - }; - return METRIC.hbasehostStatus(condition, limit); - }; - - METRIC.regionserverStatus = function (hostname, siteid) { - var hoststateinfo; - var condition = { - site: siteid, - role: "regionserver", - hostname: hostname - }; - hoststateinfo = METRIC.hbasehostStatus(condition, 1); - return hoststateinfo; - }; - - METRIC.regionserverList = function (siteid) { - var hoststateinfos; - var condition = { - site: siteid, - role: "regionserver" - }; - hoststateinfos = METRIC.hbasehostStatus(condition); - return hoststateinfos; - }; - - METRIC.getMetricObj = function () { - var deferred = $q.defer(); - $http.get("apps/hadoop_metric/config.json").success(function (resp) { - deferred.resolve(resp); - }); - return deferred.promise; - }; - return METRIC; - }); - - hadoopMetricApp.requireCSS("style/index.css"); - hadoopMetricApp.require("widgets/availabilityChart.js"); - hadoopMetricApp.require("ctrls/overview.js"); - hadoopMetricApp.require("ctrls/hdfs.js"); - hadoopMetricApp.require("ctrls/regionDetailCtrl.js"); - hadoopMetricApp.require("ctrls/regionListCtrl.js"); - hadoopMetricApp.require("ctrls/backupMasterListCtrl.js"); -})(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html deleted file mode 100644 index 13e20c948d..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html +++ /dev/null @@ -1,52 +0,0 @@ - -

-
-

- -

-
-
-
- - - - - - - - - - - - - - - - - -
MasterRackSiteIdStatus
- {{item.tags.hostname}} - {{item.tags.rack}}{{item.tags.site}} - {{item.status}} -
-
-
-
diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html deleted file mode 100644 index 3c85f07f71..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - -HDFS Page diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html deleted file mode 100644 index 86a15917e9..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html +++ /dev/null @@ -1,111 +0,0 @@ - - -
-
- -

- HBase Service Summary Information -

-
-
- - - - - - - - - - - - - - - - - - - -
- {{hmasteractivenum}} - - Active HBase Master - {{regionsnum}} - - Regions -
- - {{hmasterstandbynum}} - 0 - Backup HBase Master - {{common.number.format(hmasteraverageload, 0)}} - - Average Load
- - {{regionserverhealtynum+regionserverunhealtynum}} - 0 - RegionServers: - - {{regionserverhealtynum}} - 0 - Good Health / - - {{regionserverunhealtynum}} - 0 - Bad Health -
-
-
- -
-
- -

- Metrics - ({{defaultHostname}}) -

-
-
-
-
-
-

{{metricList[chart.name].title}}

-
-
-
- -
-
-
-
-
-
- NO DATA -
-
-
-
-
-
-
-
diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html deleted file mode 100644 index 63a895f263..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html +++ /dev/null @@ -1,117 +0,0 @@ - - -
-
- -

- Summary -

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Status - Healthy - UnHealthy -
Rack{{regionstatus[0].tags.rack}}
MaxHeap{{regionstatus[0].maxHeapMB}} MB
UsedHeap{{regionstatus[0].usedHeapMB}} MB
NumRegions{{regionstatus[0].numRegions}}
NumRequests{{regionstatus[0].numRequests}}
StatusUnknow
RackUnknow
MaxHeapUnknow
UsedHeapUnknow
NumRegionsUnknow
NumRequestsUnknow
-
-
- -
-
- -

- Metrics -

-
-
-
-
-
-

{{metricList[chart.name].title}}

-
-
-
- -
-
-
-
-
- NO DATA -
-
-
-
-
-
-
diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html deleted file mode 100644 index d1a74407e2..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionList.html +++ /dev/null @@ -1,53 +0,0 @@ - -
-
-

- -

-
-
-
- - - - - - - - - - - - - - - - - -
RegionServerRackSiteIdStatus
- {{item.tags.hostname}} - {{item.tags.rack}}{{item.tags.site}} - Healthy - UnHealthy -
-
-
-
diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js deleted file mode 100644 index 2359c597d4..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js +++ /dev/null @@ -1,145 +0,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. - */ - -(function () { - /** - * `register` without params will load the module which using require - */ - register(function (hadoopMetricApp) { - var COLOR_MAPPING = { - HDFS: 'orange', - HBase: 'yellow', - Yarn: 'green' - }; - - hadoopMetricApp.directive("hadoopMetricWidget", function () { - return { - restrict: 'AE', - 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 - }; - }); - } else { - $scope.list = [{ - siteId: site.siteId, - siteName: site.siteName || site.siteId - }]; - } - // Get type - $scope.type = $attrs.type; - - // Customize chart color - $scope.bgColor = COLOR_MAPPING[$scope.type]; - - function countHBaseRole(site, status, role, groups, filed, limit) { - var jobCond = { - site: site, - status: status, - role: role - }; - return METRIC.aggHBaseInstance(jobCond, groups, filed, limit); - } - - // Ref: jpm widget if need keep refresh the widget - - function refresh() { - $.each($scope.list, function (i, site) { - - countHBaseRole(site.siteId, "active", "hmaster", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.hmasteractivenum = data.value[0]; - }); - }); - countHBaseRole(site.siteId, "standby", "hmaster", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.hmasterstandbynum = data.value[0]; - }); - }); - countHBaseRole(site.siteId, "live", "regionserver", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.regionserverhealtynum = data.value[0]; - }); - }); - countHBaseRole(site.siteId, "dead", "regionserver", ["site"], "count")._promise.then(function (res) { - $.map(res, function (data) { - $scope.regionserverunhealtynum = data.value[0]; - }); - }); - }); - } - - refresh(); - refreshInterval = $interval(refresh, 30 * 1000); - - $scope.$on('$destroy', function () { - $interval.cancel(refreshInterval); - }); - }, - template: - '', - replace: true - }; - }); - - function withType(serviceType) { - /** - * Customize the widget content. Return false will prevent auto compile. - * @param {{}} $element - * @param {function} $element.append - */ - return function registerWidget($element) { - $element.append( - $("
") - ); - }; - } - hadoopMetricApp.widget("availabilityHBaseChart", withType('HBase'), true); - }); -})(); diff --git a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html b/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html deleted file mode 100644 index 191ea1576e..0000000000 --- a/eagle-metric/eagle-hadoop-metric/src/main/webapp/app/apps/index.html +++ /dev/null @@ -1,6 +0,0 @@ - - -

Hadoop Metric Monitor Application!

- url: /apps/hadoop_metric - -
\ No newline at end of file diff --git a/eagle-metric/eagle-hdfs-web/pom.xml b/eagle-metric/eagle-hdfs-web/pom.xml index 2dbc8917b5..dd38416749 100644 --- a/eagle-metric/eagle-hdfs-web/pom.xml +++ b/eagle-metric/eagle-hdfs-web/pom.xml @@ -1,4 +1,3 @@ -