ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject [1/2] AMBARI-7818. Create Metrics Load Simulator.
Date Wed, 22 Oct 2014 18:12:18 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-metrics-dev d2c2a60b8 -> 55bc69d65


http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat
new file mode 100644
index 0000000..ec698db
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/RESOURCEMANAGER.dat
@@ -0,0 +1,88 @@
+jvm.JvmMetrics.GcCount 
+jvm.JvmMetrics.GcCountPS MarkSweep 
+jvm.JvmMetrics.GcCountPS Scavenge 
+jvm.JvmMetrics.GcTimeMillis 
+jvm.JvmMetrics.GcTimeMillisPS MarkSweep 
+jvm.JvmMetrics.GcTimeMillisPS Scavenge 
+jvm.JvmMetrics.LogError 
+jvm.JvmMetrics.LogFatal 
+jvm.JvmMetrics.LogInfo 
+jvm.JvmMetrics.LogWarn 
+jvm.JvmMetrics.MemHeapCommittedM 
+jvm.JvmMetrics.MemHeapMaxM 
+jvm.JvmMetrics.MemHeapUsedM 
+jvm.JvmMetrics.MemMaxM 
+jvm.JvmMetrics.MemNonHeapCommittedM 
+jvm.JvmMetrics.MemNonHeapMaxM 
+jvm.JvmMetrics.MemNonHeapUsedM 
+jvm.JvmMetrics.ThreadsBlocked 
+jvm.JvmMetrics.ThreadsNew 
+jvm.JvmMetrics.ThreadsRunnable 
+jvm.JvmMetrics.ThreadsTerminated 
+jvm.JvmMetrics.ThreadsTimedWaiting 
+jvm.JvmMetrics.ThreadsWaiting 
+metricssystem.MetricsSystem.DroppedPubAll 
+metricssystem.MetricsSystem.NumActiveSinks 
+metricssystem.MetricsSystem.NumActiveSources 
+metricssystem.MetricsSystem.NumAllSinks 
+metricssystem.MetricsSystem.NumAllSources 
+metricssystem.MetricsSystem.PublishAvgTime 
+metricssystem.MetricsSystem.PublishNumOps 
+metricssystem.MetricsSystem.Sink_timelineAvgTime 
+metricssystem.MetricsSystem.Sink_timelineDropped 
+metricssystem.MetricsSystem.Sink_timelineNumOps 
+metricssystem.MetricsSystem.Sink_timelineQsize 
+metricssystem.MetricsSystem.SnapshotAvgTime 
+metricssystem.MetricsSystem.SnapshotNumOps 
+rpc.rpc.CallQueueLength 
+rpc.rpc.NumOpenConnections 
+rpc.rpc.ReceivedBytes 
+rpc.rpc.RpcAuthenticationFailures 
+rpc.rpc.RpcAuthenticationSuccesses 
+rpc.rpc.RpcAuthorizationFailures 
+rpc.rpc.RpcAuthorizationSuccesses 
+rpc.rpc.RpcProcessingTimeAvgTime 
+rpc.rpc.RpcProcessingTimeNumOps 
+rpc.rpc.RpcQueueTimeAvgTime 
+rpc.rpc.RpcQueueTimeNumOps 
+rpc.rpc.SentBytes 
+rpcdetailed.rpcdetailed.NodeHeartbeatAvgTime 
+rpcdetailed.rpcdetailed.NodeHeartbeatNumOps 
+rpcdetailed.rpcdetailed.RegisterNodeManagerAvgTime 
+rpcdetailed.rpcdetailed.RegisterNodeManagerNumOps 
+ugi.UgiMetrics.GetGroupsAvgTime 
+ugi.UgiMetrics.GetGroupsNumOps 
+ugi.UgiMetrics.LoginFailureAvgTime 
+ugi.UgiMetrics.LoginFailureNumOps 
+ugi.UgiMetrics.LoginSuccessAvgTime 
+ugi.UgiMetrics.LoginSuccessNumOps 
+yarn.ClusterMetrics.NumActiveNMs 
+yarn.ClusterMetrics.NumDecommissionedNMs 
+yarn.ClusterMetrics.NumLostNMs 
+yarn.ClusterMetrics.NumRebootedNMs 
+yarn.ClusterMetrics.NumUnhealthyNMs 
+yarn.QueueMetrics.ActiveApplications 
+yarn.QueueMetrics.ActiveUsers 
+yarn.QueueMetrics.AggregateContainersAllocated 
+yarn.QueueMetrics.AggregateContainersReleased 
+yarn.QueueMetrics.AllocatedContainers 
+yarn.QueueMetrics.AllocatedMB 
+yarn.QueueMetrics.AllocatedVCores 
+yarn.QueueMetrics.AppsCompleted 
+yarn.QueueMetrics.AppsFailed 
+yarn.QueueMetrics.AppsKilled 
+yarn.QueueMetrics.AppsPending 
+yarn.QueueMetrics.AppsRunning 
+yarn.QueueMetrics.AppsSubmitted 
+yarn.QueueMetrics.AvailableMB 
+yarn.QueueMetrics.AvailableVCores 
+yarn.QueueMetrics.PendingContainers 
+yarn.QueueMetrics.PendingMB 
+yarn.QueueMetrics.PendingVCores 
+yarn.QueueMetrics.ReservedContainers 
+yarn.QueueMetrics.ReservedMB 
+yarn.QueueMetrics.ReservedVCores 
+yarn.QueueMetrics.running_0 
+yarn.QueueMetrics.running_1440 
+yarn.QueueMetrics.running_300 
+yarn.QueueMetrics.running_60

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat
new file mode 100644
index 0000000..38b870f
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/metrics_def/SLAVE_HBASE.dat
@@ -0,0 +1,178 @@
+ipc.IPC.authenticationFailures 
+ipc.IPC.authenticationSuccesses 
+ipc.IPC.authorizationFailures 
+ipc.IPC.authorizationSuccesses 
+ipc.IPC.numCallsInGeneralQueue 
+ipc.IPC.numCallsInPriorityQueue 
+ipc.IPC.numCallsInReplicationQueue 
+ipc.IPC.numOpenConnections 
+ipc.IPC.ProcessCallTime_75th_percentile 
+ipc.IPC.ProcessCallTime_95th_percentile 
+ipc.IPC.ProcessCallTime_99th_percentile 
+ipc.IPC.ProcessCallTime_max 
+ipc.IPC.ProcessCallTime_mean 
+ipc.IPC.ProcessCallTime_median 
+ipc.IPC.ProcessCallTime_min 
+ipc.IPC.ProcessCallTime_num_ops 
+ipc.IPC.QueueCallTime_75th_percentile 
+ipc.IPC.QueueCallTime_95th_percentile 
+ipc.IPC.QueueCallTime_99th_percentile 
+ipc.IPC.QueueCallTime_max 
+ipc.IPC.QueueCallTime_mean 
+ipc.IPC.QueueCallTime_median 
+ipc.IPC.QueueCallTime_min 
+ipc.IPC.QueueCallTime_num_ops 
+ipc.IPC.queueSize 
+ipc.IPC.receivedBytes 
+ipc.IPC.sentBytes 
+jvm.JvmMetrics.GcCount 
+jvm.JvmMetrics.GcCountConcurrentMarkSweep 
+jvm.JvmMetrics.GcCountCopy 
+jvm.JvmMetrics.GcTimeMillis 
+jvm.JvmMetrics.GcTimeMillisConcurrentMarkSweep 
+jvm.JvmMetrics.GcTimeMillisCopy 
+jvm.JvmMetrics.LogError 
+jvm.JvmMetrics.LogFatal 
+jvm.JvmMetrics.LogInfo 
+jvm.JvmMetrics.LogWarn 
+jvm.JvmMetrics.MemHeapCommittedM 
+jvm.JvmMetrics.MemHeapMaxM 
+jvm.JvmMetrics.MemHeapUsedM 
+jvm.JvmMetrics.MemMaxM 
+jvm.JvmMetrics.MemNonHeapCommittedM 
+jvm.JvmMetrics.MemNonHeapMaxM 
+jvm.JvmMetrics.MemNonHeapUsedM 
+jvm.JvmMetrics.ThreadsBlocked 
+jvm.JvmMetrics.ThreadsNew 
+jvm.JvmMetrics.ThreadsRunnable 
+jvm.JvmMetrics.ThreadsTerminated 
+jvm.JvmMetrics.ThreadsTimedWaiting 
+jvm.JvmMetrics.ThreadsWaiting 
+metricssystem.MetricsSystem.DroppedPubAll 
+metricssystem.MetricsSystem.NumActiveSinks 
+metricssystem.MetricsSystem.NumActiveSources 
+metricssystem.MetricsSystem.NumAllSinks 
+metricssystem.MetricsSystem.NumAllSources 
+metricssystem.MetricsSystem.PublishAvgTime 
+metricssystem.MetricsSystem.PublishNumOps 
+metricssystem.MetricsSystem.Sink_timelineAvgTime 
+metricssystem.MetricsSystem.Sink_timelineDropped 
+metricssystem.MetricsSystem.Sink_timelineNumOps 
+metricssystem.MetricsSystem.Sink_timelineQsize 
+metricssystem.MetricsSystem.SnapshotAvgTime 
+metricssystem.MetricsSystem.SnapshotNumOps 
+regionserver.Server.Append_75th_percentile 
+regionserver.Server.Append_95th_percentile 
+regionserver.Server.Append_99th_percentile 
+regionserver.Server.Append_max 
+regionserver.Server.Append_mean 
+regionserver.Server.Append_median 
+regionserver.Server.Append_min 
+regionserver.Server.Append_num_ops 
+regionserver.Server.blockCacheCount 
+regionserver.Server.blockCacheEvictionCount 
+regionserver.Server.blockCacheExpressHitPercent 
+regionserver.Server.blockCacheFreeSize 
+regionserver.Server.blockCacheHitCount 
+regionserver.Server.blockCacheMissCount 
+regionserver.Server.blockCacheSize 
+regionserver.Server.blockCountHitPercent 
+regionserver.Server.checkMutateFailedCount 
+regionserver.Server.checkMutatePassedCount 
+regionserver.Server.compactionQueueLength 
+regionserver.Server.Delete_75th_percentile 
+regionserver.Server.Delete_95th_percentile 
+regionserver.Server.Delete_99th_percentile 
+regionserver.Server.Delete_max 
+regionserver.Server.Delete_mean 
+regionserver.Server.Delete_median 
+regionserver.Server.Delete_min 
+regionserver.Server.Delete_num_ops 
+regionserver.Server.flushQueueLength 
+regionserver.Server.Get_75th_percentile 
+regionserver.Server.Get_95th_percentile 
+regionserver.Server.Get_99th_percentile 
+regionserver.Server.Get_max 
+regionserver.Server.Get_mean 
+regionserver.Server.Get_median 
+regionserver.Server.Get_min 
+regionserver.Server.Get_num_ops 
+regionserver.Server.hlogFileCount 
+regionserver.Server.hlogFileSize 
+regionserver.Server.Increment_75th_percentile 
+regionserver.Server.Increment_95th_percentile 
+regionserver.Server.Increment_99th_percentile 
+regionserver.Server.Increment_max 
+regionserver.Server.Increment_mean 
+regionserver.Server.Increment_median 
+regionserver.Server.Increment_min 
+regionserver.Server.Increment_num_ops 
+regionserver.Server.memStoreSize 
+regionserver.Server.Mutate_75th_percentile 
+regionserver.Server.Mutate_95th_percentile 
+regionserver.Server.Mutate_99th_percentile 
+regionserver.Server.Mutate_max 
+regionserver.Server.Mutate_mean 
+regionserver.Server.Mutate_median 
+regionserver.Server.Mutate_min 
+regionserver.Server.Mutate_num_ops 
+regionserver.Server.mutationsWithoutWALCount 
+regionserver.Server.mutationsWithoutWALSize 
+regionserver.Server.percentFilesLocal 
+regionserver.Server.readRequestCount 
+regionserver.Server.regionCount 
+regionserver.Server.regionServerStartTime 
+regionserver.Server.Replay_75th_percentile 
+regionserver.Server.Replay_95th_percentile 
+regionserver.Server.Replay_99th_percentile 
+regionserver.Server.Replay_max 
+regionserver.Server.Replay_mean 
+regionserver.Server.Replay_median 
+regionserver.Server.Replay_min 
+regionserver.Server.Replay_num_ops 
+regionserver.Server.slowAppendCount 
+regionserver.Server.slowDeleteCount 
+regionserver.Server.slowGetCount 
+regionserver.Server.slowIncrementCount 
+regionserver.Server.slowPutCount 
+regionserver.Server.staticBloomSize 
+regionserver.Server.staticIndexSize 
+regionserver.Server.storeCount 
+regionserver.Server.storeFileCount 
+regionserver.Server.storeFileIndexSize 
+regionserver.Server.storeFileSize 
+regionserver.Server.totalRequestCount 
+regionserver.Server.updatesBlockedTime 
+regionserver.Server.writeRequestCount 
+regionserver.WAL.appendCount 
+regionserver.WAL.AppendSize_75th_percentile 
+regionserver.WAL.AppendSize_95th_percentile 
+regionserver.WAL.AppendSize_99th_percentile 
+regionserver.WAL.AppendSize_max 
+regionserver.WAL.AppendSize_mean 
+regionserver.WAL.AppendSize_median 
+regionserver.WAL.AppendSize_min 
+regionserver.WAL.AppendSize_num_ops 
+regionserver.WAL.AppendTime_75th_percentile 
+regionserver.WAL.AppendTime_95th_percentile 
+regionserver.WAL.AppendTime_99th_percentile 
+regionserver.WAL.AppendTime_max 
+regionserver.WAL.AppendTime_mean 
+regionserver.WAL.AppendTime_median 
+regionserver.WAL.AppendTime_min 
+regionserver.WAL.AppendTime_num_ops 
+regionserver.WAL.slowAppendCount 
+regionserver.WAL.SyncTime_75th_percentile 
+regionserver.WAL.SyncTime_95th_percentile 
+regionserver.WAL.SyncTime_99th_percentile 
+regionserver.WAL.SyncTime_max 
+regionserver.WAL.SyncTime_mean 
+regionserver.WAL.SyncTime_median 
+regionserver.WAL.SyncTime_min 
+regionserver.WAL.SyncTime_num_ops 
+ugi.UgiMetrics.GetGroupsAvgTime 
+ugi.UgiMetrics.GetGroupsNumOps 
+ugi.UgiMetrics.LoginFailureAvgTime 
+ugi.UgiMetrics.LoginFailureNumOps 
+ugi.UgiMetrics.LoginSuccessAvgTime 
+ugi.UgiMetrics.LoginSuccessNumOps
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start.sh
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start.sh
new file mode 100644
index 0000000..0507af1
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+# set -x
+cd "$(dirname "$0")"
+
+METRICS_HOST=$1
+HOST_COUNT=$2
+
+echo $$ > sim_pid
+cat sim_pid
+#HOMEDIR
+exec  java -jar ../lib/ambari-metrics/ambari-metrics-hadoop-timelineservice-simulator*.jar
 -h `hostname -f` -n ${HOST_COUNT} -m ${METRICS_HOST} -c 15000 -s 60000

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start_slaves.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start_slaves.sh
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start_slaves.sh
new file mode 100644
index 0000000..e1e51c8
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/start_slaves.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+## set -x
+
+SLAVES=$1
+METRICS_HOST=$2
+HOST_COUNT=$3
+LOADSIM_HOMEDIR="LoadSimulator-1.0-SNAPSHOT"
+
+pdsh -w ${SLAVES} "$LOADSIM_HOMEDIR/start.sh ${METRICS_HOST} ${HOST_COUNT}'"

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/status_slaves.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/status_slaves.sh
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/status_slaves.sh
new file mode 100644
index 0000000..79787fd
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/status_slaves.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+## set -x
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop.sh
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop.sh
new file mode 100644
index 0000000..2220861
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+# set -x
+cd "$(dirname "$0")"
+read PID <./sim_pid
+
+FOUND_PID=`ps aux | grep simulator | grep $PID`
+if [ -z "${FOUND_PID}" ]
+then
+   echo "process simulator not fund under pid $PID"
+else
+   echo "process simulator running as $PID, killing"
+   kill ${PID}
+fi

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop_slaves.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop_slaves.sh
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop_slaves.sh
new file mode 100644
index 0000000..7cb567a
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/resources/scripts/stop_slaves.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+#
+# 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.
+#
+# set -x
+
+SLAVES=$1
+LOADSIM_HOMEDIR="LoadSimulator-1.0-SNAPSHOT"
+
+pdsh -w ${SLAVES} "$LOADSIM_HOMEDIR/stop.sh"

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestAppMetrics.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestAppMetrics.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestAppMetrics.java
new file mode 100644
index 0000000..499dab6
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestAppMetrics.java
@@ -0,0 +1,134 @@
+/**
+ * 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.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.data;
+
+import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.util.Json;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestAppMetrics {
+  private static final String SAMPLE_SINGLE_METRIC_HOST_JSON = "{\n" +
+    "  \"metrics\" : [ {\n" +
+    "    \"instanceid\" : \"\",\n" +
+    "    \"hostname\" : \"localhost\",\n" +
+    "    \"metrics\" : {\n" +
+    "      \"0\" : \"5.35\",\n" +
+    "      \"5000\" : \"5.35\",\n" +
+    "      \"10000\" : \"5.35\",\n" +
+    "      \"15000\" : \"5.35\"\n" +
+    "    },\n" +
+    "    \"starttime\" : \"1411663170112\",\n" +
+    "    \"appid\" : \"HOST\",\n" +
+    "    \"metricname\" : \"disk_free\"\n" +
+    "  } ]\n" +
+    "}";
+
+  private static final String SAMPLE_TWO_METRIC_HOST_JSON = "{\n" +
+    "  \"metrics\" : [ {\n" +
+    "    \"instanceid\" : \"\",\n" +
+    "    \"hostname\" : \"localhost\",\n" +
+    "    \"metrics\" : {\n" +
+    "      \"0\" : \"5.35\",\n" +
+    "      \"5000\" : \"5.35\",\n" +
+    "      \"10000\" : \"5.35\",\n" +
+    "      \"15000\" : \"5.35\"\n" +
+    "    },\n" +
+    "    \"starttime\" : \"0\",\n" +
+    "    \"appid\" : \"HOST\",\n" +
+    "    \"metricname\" : \"disk_free\"\n" +
+    "  }, {\n" +
+    "    \"instanceid\" : \"\",\n" +
+    "    \"hostname\" : \"localhost\",\n" +
+    "    \"metrics\" : {\n" +
+    "      \"0\" : \"94.0\",\n" +
+    "      \"5000\" : \"94.0\",\n" +
+    "      \"10000\" : \"94.0\",\n" +
+    "      \"15000\" : \"94.0\"\n" +
+    "    },\n" +
+    "    \"starttime\" : \"0\",\n" +
+    "    \"appid\" : \"HOST\",\n" +
+    "    \"metricname\" : \"mem_cached\"\n" +
+    "  } ]\n" +
+    "}";
+
+  private long[] timestamps;
+
+  @Before
+  public void setUp() throws Exception {
+    timestamps = new long[4];
+    timestamps[0] = 0;
+    timestamps[1] = timestamps[0] + 5000;
+    timestamps[2] = timestamps[1] + 5000;
+    timestamps[3] = timestamps[2] + 5000;
+
+  }
+
+  @Test
+  public void testHostDiskMetricsSerialization() throws IOException {
+    long timestamp = 1411663170112L;
+    AppMetrics appMetrics = new AppMetrics(new ApplicationInstance("localhost", AppID.HOST,
""), timestamp);
+
+    Metric diskFree = appMetrics.createMetric("disk_free");
+    double value = 5.35;
+
+    diskFree.putMetric(timestamps[0], Double.toString(value));
+    diskFree.putMetric(timestamps[1], Double.toString(value));
+    diskFree.putMetric(timestamps[2], Double.toString(value));
+    diskFree.putMetric(timestamps[3], Double.toString(value));
+
+    appMetrics.addMetric(diskFree);
+
+    String expected = SAMPLE_SINGLE_METRIC_HOST_JSON;
+    String s = new Json(true).serialize(appMetrics);
+
+    assertEquals("Serialized Host Metrics", expected, s);
+  }
+
+
+  @Test
+  public void testSingleHostManyMetricsSerialization() throws IOException {
+    AppMetrics appMetrics = new AppMetrics(new ApplicationInstance("localhost", AppID.HOST,
""), timestamps[0]);
+
+    Metric diskFree = appMetrics.createMetric("disk_free");
+    double value = 5.35;
+    diskFree.putMetric(timestamps[0], Double.toString(value));
+    diskFree.putMetric(timestamps[1], Double.toString(value));
+    diskFree.putMetric(timestamps[2], Double.toString(value));
+    diskFree.putMetric(timestamps[3], Double.toString(value));
+
+    appMetrics.addMetric(diskFree);
+
+    Metric memCache = appMetrics.createMetric("mem_cached");
+    double memVal = 94;
+    memCache.putMetric(timestamps[0], Double.toString(memVal));
+    memCache.putMetric(timestamps[1], Double.toString(memVal));
+    memCache.putMetric(timestamps[2], Double.toString(memVal));
+    memCache.putMetric(timestamps[3], Double.toString(memVal));
+
+    appMetrics.addMetric(memCache);
+
+    String expected = SAMPLE_TWO_METRIC_HOST_JSON;
+    String s = new Json(true).serialize(appMetrics);
+
+    assertEquals("Serialized Host Metrics", expected, s);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestMetric.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestMetric.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestMetric.java
new file mode 100644
index 0000000..2e07419
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/data/TestMetric.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.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.data;
+
+import org.apache.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.util.Json;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.fest.assertions.MapAssert.entry;
+import static org.junit.Assert.assertEquals;
+
+public class TestMetric {
+  private static final String SAMPLE_METRIC_IN_JSON = "{\n" +
+    "  \"instanceid\" : \"\",\n" +
+    "  \"hostname\" : \"localhost\",\n" +
+    "  \"metrics\" : {\n" +
+    "    \"0\" : \"5.35\",\n" +
+    "    \"5000\" : \"5.35\",\n" +
+    "    \"10000\" : \"5.35\",\n" +
+    "    \"15000\" : \"5.35\"\n" +
+    "  },\n" +
+    "  \"starttime\" : \"0\",\n" +
+    "  \"appid\" : \"HOST\",\n" +
+    "  \"metricname\" : \"disk_free\"\n" +
+    "}";
+
+  @Test
+  public void testSerializeToJson() throws IOException {
+    Metric diskOnHostMetric = new Metric(new ApplicationInstance("localhost", AppID.HOST,
""), "disk_free", 0);
+
+    long timestamp = 0;
+    double value = 5.35;
+
+    diskOnHostMetric.putMetric(timestamp, Double.toString(value));
+    diskOnHostMetric.putMetric(timestamp + 5000, Double.toString(value));
+    diskOnHostMetric.putMetric(timestamp + 10000, Double.toString(value));
+    diskOnHostMetric.putMetric(timestamp + 15000, Double.toString(value));
+
+    String expected = SAMPLE_METRIC_IN_JSON;
+    String s = new Json(true).serialize(diskOnHostMetric);
+
+    assertEquals("Json should match", expected, s);
+  }
+
+  @Test
+  public void testDeserializeObjectFromString() throws IOException {
+    String source = SAMPLE_METRIC_IN_JSON;
+
+    Metric m = new Json().deserialize(source, Metric.class);
+
+    assertEquals("localhost", m.getHostname());
+    assertEquals("HOST", m.getAppid());
+    assertEquals("", m.getInstanceid());
+    assertEquals("disk_free", m.getMetricname());
+    assertEquals("0", m.getStarttime());
+
+    assertThat(m.getMetrics()).isNotEmpty().hasSize(4).includes(
+      entry("0", "5.35"),
+      entry("5000", "5.35"),
+      entry("10000", "5.35"),
+      entry("15000", "5.35"));
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestRestMetricsSender.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestRestMetricsSender.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestRestMetricsSender.java
new file mode 100644
index 0000000..4411be5
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestRestMetricsSender.java
@@ -0,0 +1,76 @@
+/**
+ * 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.hadoop.yarn.server.applicationhistoryservice.metrics
+  .loadsimulator.net;
+
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.assertEquals;
+
+public class TestRestMetricsSender {
+
+  @Test
+  public void testPushMetrics() throws Exception {
+    final UrlService svcMock = createStrictMock(UrlService.class);
+    final String payload = "test";
+    final String expectedResponse = "mockResponse";
+
+    expect(svcMock.send(anyString())).andReturn(expectedResponse);
+    svcMock.disconnect();
+    expectLastCall();
+
+    replay(svcMock);
+
+    RestMetricsSender sender = new RestMetricsSender("expectedHostName") {
+      @Override
+      protected UrlService getConnectedUrlService() throws IOException {
+        return svcMock;
+      }
+    };
+    String response = sender.pushMetrics(payload);
+
+    verify(svcMock);
+    assertEquals("", expectedResponse, response);
+  }
+
+  @Test
+  public void testPushMetricsFailed() throws Exception {
+    final UrlService svcMock = createStrictMock(UrlService.class);
+    final String payload = "test";
+    final String expectedResponse = "mockResponse";
+    RestMetricsSender sender = new RestMetricsSender("expectedHostName") {
+      @Override
+      protected UrlService getConnectedUrlService() throws IOException {
+        return svcMock;
+      }
+    };
+
+    expect(svcMock.send(anyString())).andThrow(new IOException());
+    svcMock.disconnect();
+    expectLastCall();
+
+    replay(svcMock);
+
+    String response = sender.pushMetrics(payload);
+
+    verify(svcMock);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestStdOutMetricsSender.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestStdOutMetricsSender.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestStdOutMetricsSender.java
new file mode 100644
index 0000000..7e29ae3
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/net/TestStdOutMetricsSender.java
@@ -0,0 +1,37 @@
+/**
+ * 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.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.net;
+
+
+import org.junit.Test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+public class TestStdOutMetricsSender {
+
+  @Test
+  public void testPushMetrics() throws Exception {
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    PrintStream out = new PrintStream(baos);
+    StdOutMetricsSender sender = new StdOutMetricsSender("expectedHostName", out);
+    sender.pushMetrics("test");
+
+    System.out.println(baos.toString());
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestRandomMetricsProvider.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestRandomMetricsProvider.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestRandomMetricsProvider.java
new file mode 100644
index 0000000..462aaf0
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestRandomMetricsProvider.java
@@ -0,0 +1,36 @@
+/**
+ * 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.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.util;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
+public class TestRandomMetricsProvider {
+
+  @Test
+  public void testReturnSingle() {
+    double from = 5.25;
+    double to = 5.40;
+    RandomMetricsProvider provider = new RandomMetricsProvider(from, to);
+    double metric = provider.next();
+
+    assertTrue("Generated metric should be in range", from < metric && metric
< to);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestTimeStampProvider.java
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestTimeStampProvider.java
b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestTimeStampProvider.java
new file mode 100644
index 0000000..49272d8
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/metrics/loadsimulator/util/TestTimeStampProvider.java
@@ -0,0 +1,51 @@
+/**
+ * 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.hadoop.yarn.server.applicationhistoryservice.metrics.loadsimulator.util;
+
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+
+public class TestTimeStampProvider {
+
+  @Test
+  public void testReturnSingle() {
+    long startTime = 1411663170112L;
+    int timeStep = 5000;
+    TimeStampProvider tm = new TimeStampProvider(startTime, timeStep, 0);
+
+    long tStamp = tm.next();
+
+    assertEquals("First generated timestamp should match starttime", startTime, tStamp);
+  }
+
+  @Test
+  public void testReturnTstampsForSendInterval() throws Exception {
+    long startTime = 0;
+    int collectInterval = 5;
+    int sendInterval = 30;
+    TimeStampProvider tsp = new TimeStampProvider(startTime, collectInterval, sendInterval);
+
+    long[] timestamps = tsp.timestampsForNextInterval();
+
+    assertThat(timestamps)
+      .hasSize(6)
+      .containsOnly(0, 5, 10, 15, 20, 25);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/55bc69d6/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5544ef5..f041a28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,9 +24,6 @@
   <version>1.3.0-SNAPSHOT</version>
   <description>Ambari</description>
   <modules>
-    <module>ambari-metrics-hadoop-timelineservice</module>
-    <module>ambari-metrics</module>
-    <module>ambari-metrics</module>
     <module>ambari-metrics</module>
   </modules>
   <properties>


Mime
View raw message