Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7BF03200BBF for ; Mon, 10 Oct 2016 05:26:14 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 78DCE160ADA; Mon, 10 Oct 2016 03:26:14 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B0939160AED for ; Mon, 10 Oct 2016 05:26:12 +0200 (CEST) Received: (qmail 6256 invoked by uid 500); 10 Oct 2016 03:26:11 -0000 Mailing-List: contact commits-help@eagle.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.incubator.apache.org Delivered-To: mailing list commits@eagle.incubator.apache.org Received: (qmail 6247 invoked by uid 99); 10 Oct 2016 03:26:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Oct 2016 03:26:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 626581A0ACC for ; Mon, 10 Oct 2016 03:26:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.218 X-Spam-Level: X-Spam-Status: No, score=-6.218 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999, WEIRD_PORT=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id bt2A2W5fLNXr for ; Mon, 10 Oct 2016 03:26:04 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id B7E525FB5B for ; Mon, 10 Oct 2016 03:26:02 +0000 (UTC) Received: (qmail 6113 invoked by uid 99); 10 Oct 2016 03:26:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Oct 2016 03:26:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B29D0E08DD; Mon, 10 Oct 2016 03:26:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: qingwzhao@apache.org To: commits@eagle.incubator.apache.org Date: Mon, 10 Oct 2016 03:26:01 -0000 Message-Id: <9d6de816a9574604a9b3c9325e18a21f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] incubator-eagle git commit: [EAGLE-545] hdfs/bhase/yarn topology health check archived-at: Mon, 10 Oct 2016 03:26:14 -0000 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 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 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 @@ + + + + + + eagle-topology-check + org.apache.eagle + 0.5.0-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + + eagle-topology-entity + jar + + + UTF-8 + + + + \ 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 @@ + + + + + + eagle-parent + org.apache.eagle + 0.5.0-incubating-SNAPSHOT + ../pom.xml + + 4.0.0 + + eagle-topology-check + eagle-topology-check + eagle topology health check app + pom + + + eagle-topology-entity + eagle-topology-app + + + + + org.apache.eagle + eagle-entity-base + ${project.version} + + + org.apache.eagle + eagle-client-base + ${project.version} + + + + \ 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 @@ eagle-server eagle-jpm eagle-server-assembly + eagle-topology-check