eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qingwz...@apache.org
Subject [1/3] incubator-eagle git commit: [EAGLE-545] hdfs/bhase/yarn topology health check
Date Mon, 10 Oct 2016 03:26:01 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 8ba1b844c -> 9e8737705


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestJsonParser.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestJsonParser.java
b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestJsonParser.java
new file mode 100644
index 0000000..a708a2d
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestJsonParser.java
@@ -0,0 +1,80 @@
+/*
+ *  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.topology;
+
+import org.apache.eagle.topology.entity.JournalNodeServiceAPIEntity;
+import org.apache.eagle.topology.utils.EntityBuilderHelper;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class TestJsonParser {
+
+    @Test
+    public void test1() {
+        String jnInfoString = "{\"LastAppliedOrWrittenTxId\":\"71349818863\",\"MostRecentCheckpointTxId\":\"71337509096\"}";
+        JSONObject jsonObject = new JSONObject(jnInfoString);
+        String lastTxId = jsonObject.getString("LastAppliedOrWrittenTxId");
+        Assert.assertTrue(lastTxId.equals("71349818863"));
+    }
+
+    @Test
+    public void test2() throws UnknownHostException {
+        String journalnodeString = "[{\"stream\":\"Writing segment beginning at txid 71349604348.
\\n192.168.201.0:8485 (Written txid 71349818862), 192.168.201.1:8485 (Written txid 71349818862),
192.168.201.2:8485 (Written txid 71349818862), 192.168.201.3:8485 (Written txid 71349818862),
192.168.201.4:8485 (Written txid 71349818862)\",\"manager\":\"QJM to [192.168.201.0:8485,
192.168.201.1:8485, 192.168.201.3:8485, 192.168.201.4:8485, 192.168.201.5:8485]\",\"required\":\"true\",\"disabled\":\"false\"},{\"stream\":\"EditLogFileOutputStream(/hadoop/nn1/1/current/edits_inprogress_0000000071349604348)\",\"manager\":\"FileJournalManager(root=/hadoop/nn1/1)\",\"required\":\"false\",\"disabled\":\"false\"}]";
+        JSONArray jsonArray = new JSONArray(journalnodeString);
+        Assert.assertTrue(jsonArray.length() == 2);
+
+        JSONObject jsonMap = (JSONObject) jsonArray.get(0);
+        String QJM = jsonMap.getString("manager");
+        Assert.assertTrue(QJM.equals("QJM to [192.168.201.0:8485, 192.168.201.1:8485, 192.168.201.3:8485,
192.168.201.4:8485, 192.168.201.5:8485]"));
+
+        String STATUS_pattern = "([\\d\\.]+):\\d+\\s+\\([\\D]+(\\d+)\\)";
+        String QJM_pattern = "([\\d\\.]+):\\d+";
+
+        String stream = jsonMap.getString("stream");
+
+        Pattern status = Pattern.compile(STATUS_pattern);
+        Matcher statusMatcher = status.matcher(stream);
+        List<JournalNodeServiceAPIEntity> entities = new ArrayList<>();
+        while (statusMatcher.find()) {
+            JournalNodeServiceAPIEntity entity = new JournalNodeServiceAPIEntity();
+            entity.setTags(new HashMap<>());
+            entity.getTags().put(TopologyConstants.HOSTNAME_TAG, statusMatcher.group(1));
+            entity.setWrittenTxidDiff(Long.parseLong(statusMatcher.group(2)));
+            entities.add(entity);
+        }
+        Assert.assertTrue(entities.size() == 5);
+
+        Pattern qjm = Pattern.compile(QJM_pattern);
+        Matcher jpmMatcher = qjm.matcher(QJM);
+        List<String> hosts = new ArrayList<>();
+        while (jpmMatcher.find()) {
+            hosts.add(EntityBuilderHelper.resolveHostByIp(jpmMatcher.group(1)));
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestMRTopologyCrawler.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestMRTopologyCrawler.java
b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestMRTopologyCrawler.java
new file mode 100644
index 0000000..96d6bb2
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestMRTopologyCrawler.java
@@ -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.
+ */
+
+package org.apache.eagle.topology;
+
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.apache.eagle.topology.extractor.mr.MRTopologyCrawler;
+import org.apache.eagle.topology.resolver.TopologyRackResolver;
+import org.apache.eagle.topology.resolver.impl.DefaultTopologyRackResolver;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class TestMRTopologyCrawler {
+
+    @Test @Ignore
+    public void test() {
+        Config config = ConfigFactory.load();
+
+        TopologyCheckAppConfig topologyCheckAppConfig = TopologyCheckAppConfig.getInstance(config);
+        TopologyRackResolver rackResolver = new DefaultTopologyRackResolver();
+        MRTopologyCrawler crawler = new MRTopologyCrawler(topologyCheckAppConfig, rackResolver,
null);
+        crawler.extract();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestNetMaskTopologyRackResolver.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestNetMaskTopologyRackResolver.java
b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestNetMaskTopologyRackResolver.java
new file mode 100644
index 0000000..ea15e20
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-app/src/test/java/org/apache/eagle/topology/TestNetMaskTopologyRackResolver.java
@@ -0,0 +1,67 @@
+/*
+ * 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.topology;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+public class TestNetMaskTopologyRackResolver {
+
+    @Test
+    public void test() {
+        String hostname = "192.168.1.4";
+        int subnet = 24;
+        String result = null;
+        try {
+            InetAddress address = InetAddress.getByName(hostname);
+            int netmask = (subnet % 8) ^ 0xff;
+            int ipAddr = subnet / 8;
+            result = "rack" + (int)(address.getAddress()[ipAddr] & netmask);
+        } catch (UnknownHostException e) {
+            //e.printStackTrace();
+        }
+        Assert.assertTrue(result.equals("rack4"));
+
+    }
+
+    @Test
+    public void test2() {
+        String hostname = "192.168.1.4";
+        String netmask = "255.255.255.0";
+        String result = null;
+        try {
+            InetAddress address = InetAddress.getByName(hostname);
+            InetAddress maskAddr = InetAddress.getByName(netmask);
+            int rack = 0;
+            for (int i = 0; i < 4; i++) {
+                int tmp = maskAddr.getAddress()[i] & 0xff;
+                rack = address.getAddress()[i] & (tmp ^ 0xff);
+                if (rack != 0) break;
+            }
+            result = "rack" + rack;
+        } catch (UnknownHostException e) {
+            //e.printStackTrace();
+        }
+        Assert.assertTrue(result.equals("rack4"));
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-app/src/test/resources/application.conf
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/resources/application.conf b/eagle-topology-check/eagle-topology-app/src/test/resources/application.conf
new file mode 100644
index 0000000..be84c1d
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-app/src/test/resources/application.conf
@@ -0,0 +1,59 @@
+# 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.
+
+{
+  appId : "topologyCheckApp",
+  mode : "LOCAL",
+  workers : 1,
+
+  dataExtractorConfig : {
+    "site": "sandbox",
+    "fetchDataIntervalInSecs": 15,
+    "parseThreadPoolSize": 5,
+    "checkRetryTime" : 3,
+    "numDataFetcherSpout" : 1,
+    "numEntityPersistBolt" : 1
+  }
+
+  dataSourceConfig : {
+    hdfs.namenodeUrl: "http://sandbox.hortonworks.com:50070",
+    hbase: {
+      zkQuorum: "sandbox.hortonworks.com",
+      zkPropertyClientPort : "2181",
+      zkZnodeParent: "/hbase-unsecure",
+      kerberos : {
+        master.principal : "hadoop/_HOST@EXAMPLE.COM"
+        eagle.principal: "", #if not need, then empty
+        eagle.keytab: ""
+      }
+    },
+    mr: {
+      rmUrl: "http://sandbox.hortonworks.com:8088",
+      historyServerUrl : "http://sandbox.hortonworks.com:19888"
+    }
+  }
+
+  eagleProps : {
+    "mailHost" : "abc.com",
+    "mailDebug" : "true",
+    eagleService.host:"sandbox.hortonworks.com",
+    eagleService.port: 9090,
+    eagleService.username: "admin",
+    eagleService.password : "secret",
+    eagleService.basePath : "/rest",
+    eagleService.readTimeOutSeconds : 20,
+    eagleService.maxFlushNum : 500
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-app/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-app/src/test/resources/log4j.properties b/eagle-topology-check/eagle-topology-app/src/test/resources/log4j.properties
new file mode 100644
index 0000000..6b8c8d6
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-app/src/test/resources/log4j.properties
@@ -0,0 +1,35 @@
+# 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.
+
+log4j.rootLogger=INFO, stdout, DRFA
+
+eagle.log.dir=../logs
+eagle.log.file=eagle.log
+
+# standard output
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
+
+# Daily Rolling File Appender
+ log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender
+ log4j.appender.DRFA.File=${eagle.log.dir}/${eagle.log.file}
+ log4j.appender.DRFA.DatePattern=.yyyy-MM-dd
+## 30-day backup
+# log4j.appender.DRFA.MaxBackupIndex=30
+ log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout
+
+# Pattern format: Date LogLevel LoggerName LogMessage
+log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p [%t] %c{2}[%L]: %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/pom.xml b/eagle-topology-check/eagle-topology-entity/pom.xml
new file mode 100644
index 0000000..a4d09d5
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="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.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-topology-check</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-topology-entity</artifactId>
+    <packaging>jar</packaging>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/TopologyConstants.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/TopologyConstants.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/TopologyConstants.java
new file mode 100644
index 0000000..0e02e82
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/TopologyConstants.java
@@ -0,0 +1,96 @@
+/*
+ * 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.topology;
+
+import java.util.regex.Pattern;
+
+public class TopologyConstants {
+
+    public static final String HDFS_INSTANCE_SERVICE_NAME = "HdfsServiceInstance";
+    public static final String HBASE_INSTANCE_SERVICE_NAME = "HbaseServiceInstance";
+    public static final String MR_INSTANCE_SERVICE_NAME = "MRServiceInstance";
+    public static final String JN_INSTANCE_SERVICE_NAME = "JNServiceInstance";
+
+    public static final int DEFAULT_READ_TIMEOUT = 30 * 60 * 1000; // in milliseconds
+    public static final Pattern HTTP_HOST_MATCH_PATTERN = Pattern.compile("^https?://(.+?):-?(\\d+)/?");
+    public static final Pattern HTTP_HOST_MATCH_PATTERN_2 = Pattern.compile("^//(.+?):-?(\\d+)/");
+    public static final Pattern LOCAL_HOST_MATCH_PATTERN = Pattern.compile("^///(.+?):-?(\\d+)/");
+
+    public static final String SITE_TAG = "site";
+    public static final String RACK_TAG = "rack";
+    public static final String HOSTNAME_TAG = "hostname";
+    public static final String CATEGORY_TAG = "category";
+    public static final String ROLE_TAG = "role";
+
+    public static final String NAME_NODE_ROLE = "namenode";
+    public static final String DATA_NODE_ROLE = "datanode";
+    public static final String JOURNAL_NODE_ROLE = "journalnode";
+    public static final String RESOURCE_MANAGER_ROLE = "resourcemanager";
+    public static final String NODE_MANAGER_ROLE = "nodemanager";
+    public static final String HISTORY_SERVER_ROLE = "historyserver";
+    public static final String REGIONSERVER_ROLE = "regionserver";
+    public static final String HMASTER_ROLE = "hmaster";
+
+    // Status definitions for namenode
+    public static final String NAME_NODE_ACTIVE_STATUS = "active";
+    public static final String NAME_NODE_STANDBY_STATUS = "standby";
+
+    // Status definitions for data node
+    public static final String DATA_NODE_LIVE_STATUS = "live";
+    public static final String DATA_NODE_DEAD_STATUS = "dead";
+    public static final String DATA_NODE_LIVE_DECOMMISSIONED_STATUS = "live_decommissioned";
+    public static final String DATA_NODE_DEAD_DECOMMISSIONED_STATUS = "dead_decommissioned";
+    public static final String DATA_NODE_DEAD_NOT_DECOMMISSIONED_STATUS = "dead_not_decommissioned";
+
+    // Status definitions for resource manager
+    public static final String RESOURCE_MANAGER_ACTIVE_STATUS = "active";
+
+    // Status definitions for node manager
+    public static final String NODE_MANAGER_RUNNING_STATUS = "running";
+    public static final String NODE_MANAGER_LOST_STATUS = "lost";
+    public static final String NODE_MANAGER_UNHEALTHY_STATUS = "unhealthy";
+
+    // Status definitions for hbase regionserver
+    public static final String REGIONSERVER_LIVE_STATUS = "live";
+    public static final String REGIONSERVER_DEAD_STATUS = "dead";
+
+    // Status definitions for hbase hmaster
+    public static final String HMASTER_ACTIVE_STATUS = "active";
+    public static final String HMASTER_STANDBY_STATUS = "standby";
+
+    // metrics
+    public static final String METRIC_LIVE_RATIO_NAME_FORMAT = "hadoop.%s.live.ratio";
+    public static final String METRIC_LIVE_COUNT_NAME_FORMAT = "hadoop.%s.live.count";
+
+    // stream fields
+    // field constants
+    public static final String SERVICE_NAME_FIELD = "serviceName";
+    public static final String TOPOLOGY_DATA_FIELD = "topologyData";
+
+    public enum HadoopVersion {
+        V2
+    }
+
+    public enum TopologyType {
+        HDFS,
+        HBASE,
+        MR
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HBaseServiceTopologyAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HBaseServiceTopologyAPIEntity.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HBaseServiceTopologyAPIEntity.java
new file mode 100644
index 0000000..24761dc
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HBaseServiceTopologyAPIEntity.java
@@ -0,0 +1,99 @@
+/*
+ * 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.topology.entity;
+
+import org.apache.eagle.log.entity.meta.*;
+import org.apache.eagle.topology.TopologyConstants;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
+@Table("hadoop_topology")
+@ColumnFamily("f")
+@Prefix("hbaseservicestatus")
+@Service(TopologyConstants.HBASE_INSTANCE_SERVICE_NAME)
+@TimeSeries(false)
+public class HBaseServiceTopologyAPIEntity  extends TopologyBaseAPIEntity {
+    @Column("a")
+    private String status;
+    @Column("b")
+    private long maxHeapMB;
+    @Column("c")
+    private long usedHeapMB;
+    @Column("d")
+    private long numRegions;
+    @Column("e")
+    private long numRequests;
+    @Column("f")
+    private long lastUpdateTime;
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        valueChanged("lastUpdateTime");
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+        valueChanged("status");
+    }
+
+    public long getMaxHeapMB() {
+        return maxHeapMB;
+    }
+
+    public void setMaxHeapMB(long maxHeapMB) {
+        this.maxHeapMB = maxHeapMB;
+        valueChanged("maxHeapMB");
+    }
+
+    public long getUsedHeapMB() {
+        return usedHeapMB;
+    }
+
+    public void setUsedHeapMB(long usedHeapMB) {
+        this.usedHeapMB = usedHeapMB;
+        valueChanged("usedHeapMB");
+    }
+
+    public long getNumRegions() {
+        return numRegions;
+    }
+
+    public void setNumRegions(long numRegions) {
+        this.numRegions = numRegions;
+        valueChanged("numRegions");
+    }
+
+    public long getNumRequests() {
+        return numRequests;
+    }
+
+    public void setNumRequests(long numRequests) {
+        this.numRequests = numRequests;
+        valueChanged("numRequests");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HdfsServiceTopologyAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HdfsServiceTopologyAPIEntity.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HdfsServiceTopologyAPIEntity.java
new file mode 100644
index 0000000..0ef6d0a
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/HdfsServiceTopologyAPIEntity.java
@@ -0,0 +1,101 @@
+/*
+ * 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.topology.entity;
+
+import org.apache.eagle.log.entity.meta.*;
+import org.apache.eagle.topology.TopologyConstants;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@Table("hadoop_topology")
+@ColumnFamily("f")
+@Prefix("hdfsservicestatus")
+@Service(TopologyConstants.HDFS_INSTANCE_SERVICE_NAME)
+@TimeSeries(false)
+public class HdfsServiceTopologyAPIEntity extends TopologyBaseAPIEntity {
+    @Column("a")
+    private String status;
+    @Column("b")
+    private String configuredCapacityTB;
+    @Column("c")
+    private String usedCapacityTB;
+    @Column("d")
+    private String numBlocks;
+    @Column("e")
+    private String numFailedVolumes;
+    @Column("f")
+    private long writtenTxidDiff;
+    @Column("g")
+    private long lastUpdateTime;
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        valueChanged("lastUpdateTime");
+    }
+
+    public String getNumFailedVolumes() {
+        return numFailedVolumes;
+    }
+    public void setNumFailedVolumes(String numFailedVolumes) {
+        this.numFailedVolumes = numFailedVolumes;
+        valueChanged("numFailedVolumes");
+    }
+    public String getNumBlocks() {
+        return numBlocks;
+    }
+    public void setNumBlocks(String numBlocks) {
+        this.numBlocks = numBlocks;
+        valueChanged("numBlocks");
+    }
+    public String getStatus() {
+        return status;
+    }
+    public void setStatus(String status) {
+        this.status = status;
+        valueChanged("status");
+    }
+    public String getConfiguredCapacityTB() {
+        return configuredCapacityTB;
+    }
+    public void setConfiguredCapacityTB(String configuredCapacityTB) {
+        this.configuredCapacityTB = configuredCapacityTB;
+        valueChanged("configuredCapacityTB");
+    }
+    public String getUsedCapacityTB() {
+        return usedCapacityTB;
+    }
+    public void setUsedCapacityTB(String usedCapacityTB) {
+        this.usedCapacityTB = usedCapacityTB;
+        valueChanged("usedCapacityTB");
+    }
+
+    public long getWrittenTxidDiff() {
+        return writtenTxidDiff;
+    }
+
+    public void setWrittenTxidDiff(long writtenTxidDiff) {
+        this.writtenTxidDiff = writtenTxidDiff;
+        valueChanged("writtenTxidDiff");
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/JournalNodeServiceAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/JournalNodeServiceAPIEntity.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/JournalNodeServiceAPIEntity.java
new file mode 100644
index 0000000..f21ad7a
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/JournalNodeServiceAPIEntity.java
@@ -0,0 +1,66 @@
+/*
+ *  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.topology.entity;
+
+import org.apache.eagle.log.entity.meta.*;
+import org.apache.eagle.topology.TopologyConstants;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@Table("hadoop_topology")
+@ColumnFamily("f")
+@Prefix("journalnodestatus")
+@Service(TopologyConstants.JN_INSTANCE_SERVICE_NAME)
+@TimeSeries(false)
+@Tags({TopologyConstants.SITE_TAG, TopologyConstants.HOSTNAME_TAG, TopologyConstants.RACK_TAG,
 TopologyConstants.ROLE_TAG})
+public class JournalNodeServiceAPIEntity extends TopologyBaseAPIEntity {
+    @Column("a")
+    private long writtenTxidDiff;
+    @Column("b")
+    private String status;
+    @Column("c")
+    private long lastUpdateTime;
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        valueChanged("lastUpdateTime");
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+        valueChanged("status");
+    }
+
+    public long getWrittenTxidDiff() {
+        return writtenTxidDiff;
+    }
+
+    public void setWrittenTxidDiff(long writtenTxidDiff) {
+        this.writtenTxidDiff = writtenTxidDiff;
+        valueChanged("writtenTxidDiff");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/MRServiceTopologyAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/MRServiceTopologyAPIEntity.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/MRServiceTopologyAPIEntity.java
new file mode 100644
index 0000000..75dfbfb
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/MRServiceTopologyAPIEntity.java
@@ -0,0 +1,81 @@
+/*
+ * 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.topology.entity;
+
+import org.apache.eagle.log.entity.meta.*;
+import org.apache.eagle.topology.TopologyConstants;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@Table("hadoop_topology")
+@ColumnFamily("f")
+@Prefix("mrservicestatus")
+@Service(TopologyConstants.MR_INSTANCE_SERVICE_NAME)
+@TimeSeries(false)
+public class MRServiceTopologyAPIEntity  extends TopologyBaseAPIEntity {
+    @Column("a")
+    private String status;
+    @Column("b")
+    private String numConfiguredMapSlots;
+    @Column("c")
+    private String numConfiguredReduceSlots;
+    @Column("d")
+    private String healthReport;
+    @Column("e")
+    private long lastUpdateTime;
+
+    public long getLastUpdateTime() {
+        return lastUpdateTime;
+    }
+
+    public void setLastUpdateTime(long lastUpdateTime) {
+        this.lastUpdateTime = lastUpdateTime;
+        valueChanged("lastUpdateTime");
+    }
+
+    public String getStatus() {
+        return status;
+    }
+    public void setStatus(String status) {
+        this.status = status;
+        valueChanged("status");
+    }
+    public String getNumConfiguredMapSlots() {
+        return numConfiguredMapSlots;
+    }
+    public void setNumConfiguredMapSlots(String numConfiguredMapSlots) {
+        this.numConfiguredMapSlots = numConfiguredMapSlots;
+        valueChanged("numConfiguredMapSlots");
+    }
+    public String getNumConfiguredReduceSlots() {
+        return numConfiguredReduceSlots;
+    }
+    public void setNumConfiguredReduceSlots(String numConfiguredReduceSlots) {
+        this.numConfiguredReduceSlots = numConfiguredReduceSlots;
+        valueChanged("numConfiguredReduceSlots");
+    }
+    public String getHealthReport() {
+        return healthReport;
+    }
+    public void setHealthReport(String healthReport) {
+        this.healthReport = healthReport;
+        valueChanged("healthReport");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyBaseAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyBaseAPIEntity.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyBaseAPIEntity.java
new file mode 100644
index 0000000..d1030b5
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyBaseAPIEntity.java
@@ -0,0 +1,25 @@
+/*
+ * 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.topology.entity;
+
+import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
+
+public abstract class TopologyBaseAPIEntity extends TaggedLogAPIEntity {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyEntityRepository.java
----------------------------------------------------------------------
diff --git a/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyEntityRepository.java
b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyEntityRepository.java
new file mode 100644
index 0000000..e4de886
--- /dev/null
+++ b/eagle-topology-check/eagle-topology-entity/src/main/java/org/apache/eagle/topology/entity/TopologyEntityRepository.java
@@ -0,0 +1,30 @@
+/*
+ * 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.topology.entity;
+
+import org.apache.eagle.log.entity.repo.EntityRepository;
+
+public class TopologyEntityRepository extends EntityRepository {
+    public TopologyEntityRepository() {
+        entitySet.add(HBaseServiceTopologyAPIEntity.class);
+        entitySet.add(HdfsServiceTopologyAPIEntity.class);
+        entitySet.add(MRServiceTopologyAPIEntity.class);
+        entitySet.add(JournalNodeServiceAPIEntity.class);
+   }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/eagle-topology-check/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-topology-check/pom.xml b/eagle-topology-check/pom.xml
new file mode 100644
index 0000000..b26e32b
--- /dev/null
+++ b/eagle-topology-check/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="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.
+  ~
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>eagle-parent</artifactId>
+        <groupId>org.apache.eagle</groupId>
+        <version>0.5.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>eagle-topology-check</artifactId>
+    <name>eagle-topology-check</name>
+    <description>eagle topology health check app</description>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>eagle-topology-entity</module>
+        <module>eagle-topology-app</module>
+    </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-entity-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.eagle</groupId>
+            <artifactId>eagle-client-base</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9e873770/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fd8cb52..7246943 100755
--- a/pom.xml
+++ b/pom.xml
@@ -138,6 +138,7 @@
         <module>eagle-server</module>
         <module>eagle-jpm</module>
         <module>eagle-server-assembly</module>
+        <module>eagle-topology-check</module>
     </modules>
     <properties>
         <!-- General Properties -->



Mime
View raw message