From 8b1669e76a3c705916dac736a261adaa62dde931 Mon Sep 17 00:00:00 2001 From: chitin Date: Mon, 20 Feb 2017 19:05:12 +0800 Subject: [PATCH 1/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 --- .../src/main/webapp/app/apps/index.html | 6 - eagle-metric/eagle-hadoop-metric/pom.xml | 34 ++++++ .../eagle/metric/HadoopMetricMonitorApp.java | 80 ++++++------- .../HadoopMetricMonitorAppProdiver.java | 0 ....metric.HadoopMetricMonitorAppProdiver.xml | 7 -- ...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 .../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-metric/eagle-hbase-web/pom.xml | 57 +++++++++ .../HBaseMetricWebApplicationProvider.java | 23 ++++ ...tric.HBaseMetricWebApplicationProvider.xml | 46 +++++++ ...g.apache.eagle.app.spi.ApplicationProvider | 16 +++ .../main/webapp/app/apps/hbase}/.editorconfig | 0 .../main/webapp/app/apps/hbase}/config.json | 0 .../apps/hbase}/ctrls/backupMasterListCtrl.js | 0 .../webapp/app/apps/hbase}/ctrls/overview.js | 0 .../app/apps/hbase}/ctrls/regionDetailCtrl.js | 0 .../app/apps/hbase}/ctrls/regionListCtrl.js | 0 .../src/main/webapp/app/apps/hbase/index.html | 6 + .../src/main/webapp/app/apps/hbase}/index.js | 16 +-- .../hbase}/partials/backupMasterList.html | 0 .../app/apps/hbase}/partials/overview.html | 0 .../hbase}/partials/region/regionDetail.html | 0 .../hbase}/partials/region/regionList.html | 0 .../webapp/app/apps/hbase}/style/index.css | 0 .../apps/hbase}/widgets/availabilityChart.js | 2 +- .../src/main/webapp/package.json | 0 ...HBaseMetricWebApplicationProviderTest.java | 104 ++++++++++++++++ eagle-metric/eagle-hdfs-web/pom.xml | 57 +++++++++ .../HdfsMetricWebApplicationProvider.java | 23 ++++ ...etric.HdfsMetricWebApplicationProvider.xml | 46 +++++++ ...g.apache.eagle.app.spi.ApplicationProvider | 16 +++ .../main/webapp/app/apps/hdfs/.editorconfig | 27 +++++ .../webapp/app/apps/hdfs/ctrl/overview.js | 57 ++++----- .../src/main/webapp/app/apps/hdfs/index.html | 6 + .../src/main/webapp/app/apps/hdfs/index.js | 42 +++++++ .../app/apps/hdfs/partials/overview.html | 36 +++--- .../main/webapp/app/apps/hdfs/style/index.css | 88 ++++++++++++++ .../app/apps/hdfs/widget/availabilityChart.js | 105 ++++++++++++++++ .../src/main/webapp/package.json | 0 .../HdfsMetricWebApplicationProviderTest.java | 105 ++++++++++++++++ {eagle-hadoop-metric => eagle-metric}/pom.xml | 21 ++-- ...g.apache.eagle.app.spi.ApplicationProvider | 6 +- pom.xml | 2 +- 52 files changed, 1075 insertions(+), 297 deletions(-) delete mode 100644 eagle-hadoop-metric/src/main/webapp/app/apps/index.html create mode 100644 eagle-metric/eagle-hadoop-metric/pom.xml 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 (96%) 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/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%) create mode 100644 eagle-metric/eagle-hbase-web/pom.xml create mode 100644 eagle-metric/eagle-hbase-web/src/main/java/org/apache/eagle/metric/HBaseMetricWebApplicationProvider.java create mode 100644 eagle-metric/eagle-hbase-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HBaseMetricWebApplicationProvider.xml create mode 100644 eagle-metric/eagle-hbase-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/.editorconfig (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/config.json (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/ctrls/backupMasterListCtrl.js (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/ctrls/overview.js (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/ctrls/regionDetailCtrl.js (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/ctrls/regionListCtrl.js (100%) create mode 100644 eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.html rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/index.js (95%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/partials/backupMasterList.html (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/partials/overview.html (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/partials/region/regionDetail.html (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/partials/region/regionList.html (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/style/index.css (100%) rename {eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric => eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase}/widgets/availabilityChart.js (98%) create mode 100644 eagle-metric/eagle-hbase-web/src/main/webapp/package.json create mode 100644 eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java create mode 100644 eagle-metric/eagle-hdfs-web/pom.xml create mode 100644 eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/metric/HdfsMetricWebApplicationProvider.java create mode 100644 eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HdfsMetricWebApplicationProvider.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 rename eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js => eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrl/overview.js (84%) create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.html create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js rename eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html => eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html (97%) create mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/style/index.css 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/main/webapp/package.json create mode 100644 eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java rename {eagle-hadoop-metric => eagle-metric}/pom.xml (85%) diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/index.html b/eagle-hadoop-metric/src/main/webapp/app/apps/index.html deleted file mode 100644 index 191ea1576e..0000000000 --- a/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-hadoop-metric/pom.xml b/eagle-metric/eagle-hadoop-metric/pom.xml new file mode 100644 index 0000000000..9c2a8c865e --- /dev/null +++ b/eagle-metric/eagle-hadoop-metric/pom.xml @@ -0,0 +1,34 @@ + + + + + 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} + + + \ No newline at end of file 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 96% 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 index 8262da9a59..9c34b1f22d 100644 --- 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 @@ -19,13 +19,6 @@ HADOOP_METRIC_MONITOR Hadoop Metrics Monitor - /apps/hadoop_metric - - - TOPOLOGY_HEALTH_CHECK_APP - true - - 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/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-metric/eagle-hbase-web/pom.xml b/eagle-metric/eagle-hbase-web/pom.xml new file mode 100644 index 0000000000..9e61433d82 --- /dev/null +++ b/eagle-metric/eagle-hbase-web/pom.xml @@ -0,0 +1,57 @@ + + + + eagle-metric-parent + org.apache.eagle + 0.5.0-SNAPSHOT + + 4.0.0 + eagle-hbase-web + Eagle::App::HadoopMetric::HBase::WebUI + + + org.apache.eagle + eagle-app-base + ${project.version} + + + + org.apache.eagle + eagle-hadoop-metric + ${project.version} + test + + + org.apache.eagle + eagle-topology-app + ${project.version} + test + + + + + + src/main/webapp/app + assets/ + + + src/main/resources + + + + \ No newline at end of file diff --git a/eagle-metric/eagle-hbase-web/src/main/java/org/apache/eagle/metric/HBaseMetricWebApplicationProvider.java b/eagle-metric/eagle-hbase-web/src/main/java/org/apache/eagle/metric/HBaseMetricWebApplicationProvider.java new file mode 100644 index 0000000000..6f53afa2e4 --- /dev/null +++ b/eagle-metric/eagle-hbase-web/src/main/java/org/apache/eagle/metric/HBaseMetricWebApplicationProvider.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.metric; + +import org.apache.eagle.app.StaticApplicationProvider; + +public class HBaseMetricWebApplicationProvider extends StaticApplicationProvider { + // HBaseWebApplicationProvider SPI Interface +} \ No newline at end of file diff --git a/eagle-metric/eagle-hbase-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HBaseMetricWebApplicationProvider.xml b/eagle-metric/eagle-hbase-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HBaseMetricWebApplicationProvider.xml new file mode 100644 index 0000000000..564ce440da --- /dev/null +++ b/eagle-metric/eagle-hbase-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HBaseMetricWebApplicationProvider.xml @@ -0,0 +1,46 @@ + + + + + HBASE_METRIC_WEB_APP + HBase Metric Monitoring Web + /apps/hbase + HBase 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-hbase-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-metric/eagle-hbase-web/src/main/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider new file mode 100644 index 0000000000..dcbdb63871 --- /dev/null +++ b/eagle-metric/eagle-hbase-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.metric.HBaseMetricWebApplicationProvider \ No newline at end of file diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.editorconfig similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/.editorconfig rename to eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.editorconfig diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/config.json similarity index 100% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/config.json rename to eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/config.json diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/backupMasterListCtrl.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/ctrls/backupMasterListCtrl.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/overview.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/ctrls/overview.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionDetailCtrl.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionDetailCtrl.js diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/regionListCtrl.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionListCtrl.js diff --git a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.html b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.html new file mode 100644 index 0000000000..454e3c6675 --- /dev/null +++ b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.html @@ -0,0 +1,6 @@ + + +

HBase Metric Monitor Application!

+ url: /apps/hbase + + diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.js similarity index 95% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js rename to eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.js index d4789b2796..c6b5135bb1 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/index.js +++ b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/index.js @@ -22,18 +22,12 @@ */ var hadoopMetricApp = register(['ngRoute', 'ngAnimate', 'ui.router', 'eagle.service']); - hadoopMetricApp.route("HadoopMetric", { + hadoopMetricApp.route("HBaseMetric", { 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, @@ -61,8 +55,7 @@ hadoopMetricApp.portal({ name: "Services", icon: "heartbeat", list: [ - {name: "HBase", path: "hadoopService/HBase/overview"}, - {name: "HDFS", path: "hadoopService/hdfs"} + {name: "HBase", path: "hadoopService/HBase/overview"} ] }, true); @@ -82,7 +75,7 @@ var getQuery = METRIC.getQuery = function (queryName, siteId) { var baseURL; siteId = siteId || Site.current().siteId; - var app = Application.find("HADOOP_METRIC_MONITOR", siteId)[0]; + var app = Application.find("HBASE_METRIC_WEB_APP", siteId)[0]; var host = app.configuration["service.host"]; var port = app.configuration["service.port"]; @@ -319,7 +312,7 @@ METRIC.getMetricObj = function () { var deferred = $q.defer(); - $http.get("apps/hadoop_metric/config.json").success(function (resp) { + $http.get("apps/hbase/config.json").success(function (resp) { deferred.resolve(resp); }); return deferred.promise; @@ -330,7 +323,6 @@ 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-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/backupMasterList.html b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/partials/backupMasterList.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/overview.html b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/partials/overview.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/region/regionDetail.html b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/partials/region/regionList.html diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/style/index.css b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/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-hbase-web/src/main/webapp/app/apps/hbase/style/index.css diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/widgets/availabilityChart.js similarity index 98% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js rename to eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/widgets/availabilityChart.js index 2359c597d4..bd0a278fcd 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/widgets/availabilityChart.js +++ b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/widgets/availabilityChart.js @@ -103,7 +103,7 @@ '
' + '

{{type}}

' + '
' + - '' + + '' + '{{hmasteractivenum+hmasterstandbynum}} Masters (' + '{{hmasteractivenum}}0 Active / ' + '{{hmasterstandbynum}}0 Standby)' + diff --git a/eagle-metric/eagle-hbase-web/src/main/webapp/package.json b/eagle-metric/eagle-hbase-web/src/main/webapp/package.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java b/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java new file mode 100644 index 0000000000..0504ab19cf --- /dev/null +++ b/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java @@ -0,0 +1,104 @@ +package org.apache.eagle.metric;/* + * 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. + */ +import com.google.inject.Inject; +import org.apache.eagle.app.resource.ApplicationResource; +import org.apache.eagle.app.service.ApplicationOperations; +import org.apache.eagle.app.test.ApplicationTestBase; +import org.apache.eagle.metadata.model.ApplicationEntity; +import org.apache.eagle.metadata.model.SiteEntity; +import org.apache.eagle.metadata.resource.SiteResource; +import org.apache.eagle.metadata.service.ApplicationStatusUpdateService; +import org.junit.Assert; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Since 2/20/17. + */ +public class HBaseMetricWebApplicationProviderTest extends ApplicationTestBase { + @Inject + private SiteResource siteResource; + + @Inject + private ApplicationResource applicationResource; + + @Inject + private ApplicationStatusUpdateService statusUpdateService; + + private void installDependencies(){ + ApplicationOperations.InstallOperation installDependency1 = new ApplicationOperations.InstallOperation("test_site", "TOPOLOGY_HEALTH_CHECK_APP", ApplicationEntity.Mode.LOCAL); + applicationResource.installApplication(installDependency1); + + ApplicationOperations.InstallOperation installDependency2 = new ApplicationOperations.InstallOperation("test_site", "HADOOP_METRIC_MONITOR", ApplicationEntity.Mode.LOCAL); + applicationResource.installApplication(installDependency2); + } + + /** + * register site + * install app + * start app + * stop app + * uninstall app + * + * @throws InterruptedException + */ + @Test + public void testApplicationLifecycle() throws InterruptedException { + // Create local site + SiteEntity siteEntity = new SiteEntity(); + siteEntity.setSiteId("test_site"); + siteEntity.setSiteName("Test Site"); + siteEntity.setDescription("Test Site for HBASE_METRIC_WEB_APP"); + siteResource.createSite(siteEntity); + Assert.assertNotNull(siteEntity.getUuid()); + + + + ApplicationOperations.InstallOperation installOperation = new ApplicationOperations.InstallOperation("test_site", "HBASE_METRIC_WEB_APP", ApplicationEntity.Mode.LOCAL); + installOperation.setConfiguration(getConf()); + installDependencies(); + // Install application + ApplicationEntity applicationEntity = applicationResource.installApplication(installOperation).getData(); + //Todo: comment these for now, because they haven't been implemented + // Start application +// applicationResource.startApplication(new ApplicationOperations.StartOperation(applicationEntity.getUuid())); +// // Stop application +// applicationResource.stopApplication(new ApplicationOperations.StopOperation(applicationEntity.getUuid())); + //Uninstall application + awaitApplicationStop(applicationEntity); + applicationResource.uninstallApplication(new ApplicationOperations.UninstallOperation(applicationEntity.getUuid())); + try { + applicationResource.getApplicationEntityByUUID(applicationEntity.getUuid()); + Assert.fail("Application instance (UUID: " + applicationEntity.getUuid() + ") should have been uninstalled"); + } catch (Exception ex) { + // Expected exception + } + } + + private Map getConf() { + Map conf = new HashMap<>(); + conf.put("dataSinkConfig.topic", "testTopic"); + conf.put("dataSinkConfig.brokerList", "broker"); + conf.put("dataSinkConfig.serializerClass", "serializerClass"); + conf.put("dataSinkConfig.keySerializerClass", "keySerializerClass"); + conf.put("spoutNum", 2); + conf.put("mode", "LOCAL"); + return conf; + } +} diff --git a/eagle-metric/eagle-hdfs-web/pom.xml b/eagle-metric/eagle-hdfs-web/pom.xml new file mode 100644 index 0000000000..dd38416749 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/pom.xml @@ -0,0 +1,57 @@ + + + + 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-hadoop-metric + ${project.version} + test + + + org.apache.eagle + eagle-topology-app + ${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/metric/HdfsMetricWebApplicationProvider.java b/eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/metric/HdfsMetricWebApplicationProvider.java new file mode 100644 index 0000000000..434e1f4115 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/java/org/apache/eagle/metric/HdfsMetricWebApplicationProvider.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.metric; + +import org.apache.eagle.app.StaticApplicationProvider; + +public class HdfsMetricWebApplicationProvider 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.metric.HdfsMetricWebApplicationProvider.xml b/eagle-metric/eagle-hdfs-web/src/main/resources/META-INF/providers/org.apache.eagle.metric.HdfsMetricWebApplicationProvider.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.metric.HdfsMetricWebApplicationProvider.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..3dec9d08e1 --- /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.metric.HdfsMetricWebApplicationProvider \ 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-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrl/overview.js similarity index 84% rename from eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js rename to eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrl/overview.js index 74bb7bfbaa..b8d57a769b 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/ctrls/hdfs.js +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/ctrl/overview.js @@ -1,28 +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("hdfsCtrl", function ($scope, PageConfig) { - PageConfig.title = 'HDFS'; - }); - }); -})(); \ No newline at end of file +/* + * 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 (hdfsMetricApp) { + hdfsMetricApp.controller("overviewCtrl", function (PageConfig) { + PageConfig.title = 'Hdfs'; + + }); + }); +})(); diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.html b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.html new file mode 100644 index 0000000000..799ad15e6e --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.html @@ -0,0 +1,6 @@ + + +

HDFS Metric Monitor Application!

+ url: /apps/hdfs + + \ No newline at end of file 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..48b3febce9 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/index.js @@ -0,0 +1,42 @@ +/* + * 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 hdfsMetricApp = register(['ngRoute', 'ngAnimate', 'ui.router', 'eagle.service']); + + hdfsMetricApp.route("HdfsMetric", { + url: "/hadoopService/hdfs", + site: true, + templateUrl: "partials/overview.html", + controller: "overviewCtrl", + resolve: {time: true} + }); + + hdfsMetricApp.portal({ + name: "Services", icon: "heartbeat", list: [ + {name: "HDFS", path: "hadoopService/hdfs"} + ] + }, true); + + hdfsMetricApp.requireCSS("style/index.css"); + hdfsMetricApp.require("widget/availabilityChart.js"); + hdfsMetricApp.require("ctrl/overview.js"); +})(); diff --git a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.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-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html index 33acb15bd2..678b221aec 100644 --- a/eagle-hadoop-metric/src/main/webapp/app/apps/hadoop_metric/partials/hdfs/index.html +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/partials/overview.html @@ -1,19 +1,17 @@ - - -HDFS Page + + +HDFS Page diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/style/index.css b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/style/index.css new file mode 100644 index 0000000000..aa215ab276 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/style/index.css @@ -0,0 +1,88 @@ +@CHARSET "UTF-8"; +/* + * 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. + */ + +.hadoopMetric-chart { + position: relative; + margin-bottom: 15px; +} + +.hadoopMetric-chart h3 { + font-size: 20px; + margin: 10px 0 0 0; +} + +.hadoopMetric-chart .hadoopMetric-chart-container { + height: 300px; + position: relative; +} + +.hadoopMetric-chart .hadoopMetric-no-chart-data { + position:absolute; + left: 38%; + top: 40%; + font-size: 20px; + color: #999; +} + +.with-border .hadoopMetric-chart { + padding-bottom: 15px; + margin-bottom: 15px; + border-bottom: 1px solid #f4f4f4; +} + +.with-border .hadoopMetric-chart:last-child { + padding-bottom: 0; + margin-bottom: 0; + border-bottom: 0; +} + +.hadoopMetric-widget { + width: 100%; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); + border-radius: 2px; + padding: 10px; +} + +.hadoopMetric-widget h3 { + margin: 0; + padding: 0; +} + +.hadoopMetric-widget .hadoopMetric-chart-container { + height: 100px; +} + +.hadoopMetric-summary-a { + color: #fff; +} + +.small-box.hadoopMetric-widget { + margin: 0; + height: 100%; + min-height: 110px; +} + +.hadoopMetric-widget-detail { + margin-left: 12px; + margin-top: 10px; +} + +.hadoopMetric-table { + text-align: right; +} diff --git a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/widget/availabilityChart.js b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/widget/availabilityChart.js new file mode 100644 index 0000000000..fbfc73d74a --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/widget/availabilityChart.js @@ -0,0 +1,105 @@ +/* + * 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 (hdfsMetricApp) { + var COLOR_MAPPING = { + HDFS: 'orange', + HBase: 'yellow', + Yarn: 'green', + }; + + var widgetChartOption = { + color: ['#FFFFFF'], + grid: { + top: 0, + right: 0, + bottom: 0, + left: 0, + containLabel: false, + }, + xAxis: { + axisLine: {show: false}, + axisLabel: {show: false}, + }, + yAxis: [{ + axisLine: {show: false}, + axisLabel: {show: false}, + axisTick: {show: false}, + splitLine: {show: false}, + }], + }; + + hdfsMetricApp.directive("hdfsMetricWidget", function () { + return { + restrict: 'AE', + controller: function($scope, $attrs) { + // Get site + var site = $scope.site; + + // Get type + $scope.type = $attrs.type; + + // Customize chart color + $scope.bgColor = COLOR_MAPPING[$scope.type]; + + $scope.chartOption = widgetChartOption; + + // Mock fetch data + var now = +new Date(); + var data = []; + for(var j = 0 ; j < 30 ; j += 1) { + data.push({x: now + j * 1000 * 60, y: Math.random() * 100}); + } + $scope.series = [{ + name: '', + type: 'line', + data: data, + showSymbol: false, + }]; + + // Ref: jpm widget if need keep refresh the widget + }, + template: + '
' + + '

{{type}}

' + + '
' + + '
', + 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( + $("
") + ); + } + } + + hdfsMetricApp.widget("availabilityHdfsChart", withType('HDFS'), true); + }); +})(); 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 diff --git a/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java b/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java new file mode 100644 index 0000000000..8af45e4617 --- /dev/null +++ b/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java @@ -0,0 +1,105 @@ +/* + * 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.google.inject.Inject; +import org.apache.eagle.app.resource.ApplicationResource; +import org.apache.eagle.app.service.ApplicationOperations; +import org.apache.eagle.app.test.ApplicationTestBase; +import org.apache.eagle.metadata.model.ApplicationEntity; +import org.apache.eagle.metadata.model.SiteEntity; +import org.apache.eagle.metadata.resource.SiteResource; +import org.apache.eagle.metadata.service.ApplicationStatusUpdateService; +import org.junit.Assert; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Since 2/20/17. + */ +public class HdfsMetricWebApplicationProviderTest extends ApplicationTestBase { + @Inject + private SiteResource siteResource; + + @Inject + private ApplicationResource applicationResource; + + @Inject + private ApplicationStatusUpdateService statusUpdateService; + + private void installDependencies(){ + ApplicationOperations.InstallOperation installDependency1 = new ApplicationOperations.InstallOperation("test_site", "TOPOLOGY_HEALTH_CHECK_APP", ApplicationEntity.Mode.LOCAL); + applicationResource.installApplication(installDependency1); + + ApplicationOperations.InstallOperation installDependency2 = new ApplicationOperations.InstallOperation("test_site", "HADOOP_METRIC_MONITOR", ApplicationEntity.Mode.LOCAL); + applicationResource.installApplication(installDependency2); + } + + /** + * register site + * install app + * start app + * stop app + * uninstall app + * + * @throws InterruptedException + */ + @Test + public void testApplicationLifecycle() throws InterruptedException { + // Create local site + SiteEntity siteEntity = new SiteEntity(); + siteEntity.setSiteId("test_site"); + siteEntity.setSiteName("Test Site"); + siteEntity.setDescription("Test Site for HDFS_METRIC_WEB_APP"); + siteResource.createSite(siteEntity); + Assert.assertNotNull(siteEntity.getUuid()); + + + + ApplicationOperations.InstallOperation installOperation = new ApplicationOperations.InstallOperation("test_site", "HDFS_METRIC_WEB_APP", ApplicationEntity.Mode.LOCAL); + installOperation.setConfiguration(getConf()); + installDependencies(); + // Install application + ApplicationEntity applicationEntity = applicationResource.installApplication(installOperation).getData(); + //Todo: comment these for now, because they haven't been implemented + // Start application +// applicationResource.startApplication(new ApplicationOperations.StartOperation(applicationEntity.getUuid())); +// // Stop application +// applicationResource.stopApplication(new ApplicationOperations.StopOperation(applicationEntity.getUuid())); + //Uninstall application + awaitApplicationStop(applicationEntity); + applicationResource.uninstallApplication(new ApplicationOperations.UninstallOperation(applicationEntity.getUuid())); + try { + applicationResource.getApplicationEntityByUUID(applicationEntity.getUuid()); + Assert.fail("Application instance (UUID: " + applicationEntity.getUuid() + ") should have been uninstalled"); + } catch (Exception ex) { + // Expected exception + } + } + + private Map getConf() { + Map conf = new HashMap<>(); + conf.put("dataSinkConfig.topic", "testTopic"); + conf.put("dataSinkConfig.brokerList", "broker"); + conf.put("dataSinkConfig.serializerClass", "serializerClass"); + conf.put("dataSinkConfig.keySerializerClass", "keySerializerClass"); + conf.put("spoutNum", 2); + conf.put("mode", "LOCAL"); + return conf; + } +} diff --git a/eagle-hadoop-metric/pom.xml b/eagle-metric/pom.xml similarity index 85% rename from eagle-hadoop-metric/pom.xml rename to eagle-metric/pom.xml index 0677f3bd99..a2fe4148d1 100644 --- a/eagle-hadoop-metric/pom.xml +++ b/eagle-metric/pom.xml @@ -23,8 +23,15 @@ 4.0.0 - eagle-hadoop-metric + eagle-metric-parent Eagle::App::HadoopMetric + pom + + eagle-hadoop-metric + eagle-hdfs-web + eagle-hbase-web + + org.apache.eagle @@ -52,16 +59,4 @@ test - - - - - src/main/webapp/app - assets/ - - - src/main/resources - - - \ No newline at end of file diff --git a/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider b/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider index f50fc1da00..54650bdff9 100644 --- a/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider +++ b/eagle-topology-assembly/src/resources/META-INF/services/org.apache.eagle.app.spi.ApplicationProvider @@ -28,4 +28,8 @@ org.apache.eagle.jpm.aggregation.AggregationApplicationProvider org.apache.eagle.hadoop.queue.HadoopQueueRunningAppProvider org.apache.eagle.topology.TopologyCheckAppProvider org.apache.eagle.metric.HadoopMetricMonitorAppProdiver -org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider \ No newline at end of file +org.apache.eagle.jpm.spark.history.SparkHistoryJobAppProvider + +## Metric +org.apache.eagle.metric.HdfsMetricWebApplicationProvider +org.apache.eagle.metric.HBaseMetricWebApplicationProvider \ No newline at end of file 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 2172e8406d47f613d23b80112a222344970f65b9 Mon Sep 17 00:00:00 2001 From: chitin Date: Mon, 20 Feb 2017 19:18:39 +0800 Subject: [PATCH 2/4] [EAGLE-900] Only show left navigation item (HDFS, HBase) when we install the JMX application - Modify pom.xml https://issues.apache.org/jira/browse/EAGLE-900 --- eagle-metric/eagle-hadoop-metric/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eagle-metric/eagle-hadoop-metric/pom.xml b/eagle-metric/eagle-hadoop-metric/pom.xml index 9c2a8c865e..21c351ce2b 100644 --- a/eagle-metric/eagle-hadoop-metric/pom.xml +++ b/eagle-metric/eagle-hadoop-metric/pom.xml @@ -23,7 +23,7 @@ 4.0.0 eagle-hadoop-metric - Eagle::App::HadoopMetric::Hdfs::WebUI + Eagle::App::HadoopMetric org.apache.eagle From e0c19a47e8590d201a85f2fbc199c52c707dc4a4 Mon Sep 17 00:00:00 2001 From: chitin Date: Tue, 21 Feb 2017 08:51:30 +0800 Subject: [PATCH 3/4] [EAGLE-900] Only show left navigation item (HDFS, HBase) when we install the JMX application - Delete useless file https://issues.apache.org/jira/browse/EAGLE-900 --- .../main/webapp/app/apps/hbase/.editorconfig | 27 ------------------- .../main/webapp/app/apps/hdfs/.editorconfig | 27 ------------------- eagle-server/pom.xml | 11 ++++++++ 3 files changed, 11 insertions(+), 54 deletions(-) delete mode 100644 eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.editorconfig delete mode 100644 eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig diff --git a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.editorconfig b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.editorconfig deleted file mode 100644 index 42a9b6997c..0000000000 --- a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/.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-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig b/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.editorconfig deleted file mode 100644 index 42a9b6997c..0000000000 --- a/eagle-metric/eagle-hdfs-web/src/main/webapp/app/apps/hdfs/.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-server/pom.xml b/eagle-server/pom.xml index 6bb9fbd38e..c2cefcda03 100644 --- a/eagle-server/pom.xml +++ b/eagle-server/pom.xml @@ -336,6 +336,17 @@ eagle-hadoop-metric ${project.version} + + + org.apache.eagle + eagle-hdfs-web + ${project.version} + + + org.apache.eagle + eagle-hbase-web + ${project.version} + From 346e1b5c30d0b8695565c0c087f83abe86039cc1 Mon Sep 17 00:00:00 2001 From: chitin Date: Wed, 22 Feb 2017 11:18:44 +0800 Subject: [PATCH 4/4] Change the metric charts order and format y axis --- .../app/apps/hbase/ctrls/regionDetailCtrl.js | 56 +++++++++++++------ .../app/apps/hbase/partials/overview.html | 8 +-- ...HBaseMetricWebApplicationProviderTest.java | 8 +-- .../HdfsMetricWebApplicationProviderTest.java | 8 +-- eagle-metric/pom.xml | 12 ++++ 5 files changed, 58 insertions(+), 34 deletions(-) diff --git a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionDetailCtrl.js b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionDetailCtrl.js index 42d5367067..838b3a2152 100644 --- a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionDetailCtrl.js +++ b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/ctrls/regionDetailCtrl.js @@ -52,6 +52,26 @@ } }] }; + var digitalOption = { + animation: false, + tooltip: { + formatter: function (points) { + return points[0].name + "
" + + $.map(points, function (point) { + return ' ' + + point.seriesName + ": " + + common.number.abbr(point.value, false, 0); + }).reverse().join("
"); + } + }, + yAxis: [{ + axisLabel: { + formatter: function (value) { + return common.number.abbr(value, false); + } + } + }] + }; var gctimeoption = { legend: { @@ -114,12 +134,12 @@ { name: "QueueCallTime_num_ops", metrics: ["QueueCallTime_num_ops"], - option: {} + option: digitalOption }, { name: "ProcessCallTime_num_ops", metrics: ["ProcessCallTime_num_ops"], - option: {} + option: digitalOption }, { name: "RegionCount", @@ -141,21 +161,6 @@ metrics: ["StoreFileSize"], option: sizeoption }, - { - name: "TotalRequestCount", - metrics: ["TotalRequestCount"], - option: {} - }, - { - name: "ReadRequestCount", - metrics: ["ReadRequestCount"], - option: {} - }, - { - name: "WriteRequestCount", - metrics: ["WriteRequestCount"], - option: {} - }, { name: "SlitQueueLength", metrics: ["SlitQueueLength"], @@ -184,7 +189,22 @@ { name: "BlockCacheCountHitPercent", metrics: ["BlockCacheCountHitPercent"], - option: {} + option: digitalOption + }, + { + name: "TotalRequestCount", + metrics: ["TotalRequestCount"], + option: digitalOption + }, + { + name: "ReadRequestCount", + metrics: ["ReadRequestCount"], + option: digitalOption + }, + { + name: "WriteRequestCount", + metrics: ["WriteRequestCount"], + option: digitalOption } ]; diff --git a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/partials/overview.html b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/partials/overview.html index 86a15917e9..0e194ef8fb 100644 --- a/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/partials/overview.html +++ b/eagle-metric/eagle-hbase-web/src/main/webapp/app/apps/hbase/partials/overview.html @@ -28,12 +28,12 @@

{{hmasteractivenum}} - + N/A Active HBase Master {{regionsnum}} - + N/A Regions @@ -47,7 +47,7 @@

Backup HBase Master {{common.number.format(hmasteraverageload, 0)}} - + N/A Average Load @@ -55,7 +55,7 @@

{{regionserverhealtynum+regionserverunhealtynum}} - 0 + N/A RegionServers: diff --git a/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java b/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java index 0504ab19cf..eae05e594d 100644 --- a/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java +++ b/eagle-metric/eagle-hbase-web/src/test/org/apache/eagle/metric/HBaseMetricWebApplicationProviderTest.java @@ -93,12 +93,8 @@ public void testApplicationLifecycle() throws InterruptedException { private Map getConf() { Map conf = new HashMap<>(); - conf.put("dataSinkConfig.topic", "testTopic"); - conf.put("dataSinkConfig.brokerList", "broker"); - conf.put("dataSinkConfig.serializerClass", "serializerClass"); - conf.put("dataSinkConfig.keySerializerClass", "keySerializerClass"); - conf.put("spoutNum", 2); - conf.put("mode", "LOCAL"); + conf.put("service.host", "localhost"); + conf.put("service.port", "9090"); return conf; } } diff --git a/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java b/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java index 8af45e4617..8e61af40f2 100644 --- a/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java +++ b/eagle-metric/eagle-hdfs-web/src/test/org/apache/eagle/metric/HdfsMetricWebApplicationProviderTest.java @@ -94,12 +94,8 @@ public void testApplicationLifecycle() throws InterruptedException { private Map getConf() { Map conf = new HashMap<>(); - conf.put("dataSinkConfig.topic", "testTopic"); - conf.put("dataSinkConfig.brokerList", "broker"); - conf.put("dataSinkConfig.serializerClass", "serializerClass"); - conf.put("dataSinkConfig.keySerializerClass", "keySerializerClass"); - conf.put("spoutNum", 2); - conf.put("mode", "LOCAL"); + conf.put("service.host", "localhost"); + conf.put("service.port", "9090"); return conf; } } diff --git a/eagle-metric/pom.xml b/eagle-metric/pom.xml index a2fe4148d1..6bdf434e92 100644 --- a/eagle-metric/pom.xml +++ b/eagle-metric/pom.xml @@ -59,4 +59,16 @@ test + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + true + + + + \ No newline at end of file