ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [5/5] ambari git commit: AMBARI-7681. Add Metrics Service to common services stack. (mpapirkovskyy)
Date Wed, 19 Nov 2014 00:38:21 GMT
AMBARI-7681. Add Metrics Service to common services stack. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a3ed7a3f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a3ed7a3f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a3ed7a3f

Branch: refs/heads/branch-metrics-dev
Commit: a3ed7a3fd175f4668cde7b14aa80a1e173b5b7a6
Parents: 3c23bee
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Tue Nov 18 18:19:00 2014 +0200
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Wed Nov 19 02:38:10 2014 +0200

----------------------------------------------------------------------
 .../ambari-metrics-hadoop-sink/pom.xml          |   73 +-
 .../conf/unix/ambari-metrics-collector          |  269 +++
 .../conf/unix/ams-env.sh                        |   16 +
 .../conf/unix/ams-site.xml                      |   25 +
 .../pom.xml                                     |  202 +-
 .../src/main/assemblies/phoenix-client.xml      |   62 +
 .../phoenix-components-major-client.xml         |   53 +
 .../assemblies/phoenix-components-minimal.xml   |   71 +
 .../src/main/assemblies/phoenix-server.xml      |   46 +
 .../conf/unix/ambari-metrics-monitor            |  202 ++
 .../ambari-metrics-host-monitoring/pom.xml      |  112 +-
 .../src/main/python/__init__.py                 |    2 +-
 .../src/main/python/core/__init__.py            |    1 -
 .../src/main/python/core/config_reader.py       |    6 +-
 .../src/main/python/core/emitter.py             |    5 +-
 .../src/main/python/main.py                     |    4 +-
 .../psutil/__init__.py                          | 1987 ------------------
 .../lib.macosx-10.8-intel-2.7/psutil/_common.py |  258 ---
 .../lib.macosx-10.8-intel-2.7/psutil/_compat.py |  433 ----
 .../lib.macosx-10.8-intel-2.7/psutil/_psbsd.py  |  389 ----
 .../psutil/_pslinux.py                          | 1225 -----------
 .../lib.macosx-10.8-intel-2.7/psutil/_psosx.py  |  341 ---
 .../psutil/_psposix.py                          |  157 --
 .../psutil/_pssunos.py                          |  533 -----
 .../psutil/_pswindows.py                        |  485 -----
 ambari-metrics/pom.xml                          |  110 +-
 .../apache/ambari/server/utils/StageUtils.java  |    1 +
 .../2.0.6/hooks/before-START/scripts/params.py  |    4 +
 .../templates/hadoop-metrics2.properties.j2     |   15 +
 .../services/HDFS/configuration/hadoop-env.xml  |    3 +
 .../2.2/services/AMS/configuration/ams-env.xml  |   43 +
 .../AMS/configuration/ams-hbase-env.xml         |   16 +-
 .../AMS/configuration/ams-hbase-site.xml        |   14 +-
 .../stacks/HDP/2.2/services/AMS/metainfo.xml    |   18 +-
 .../HDP/2.2/services/AMS/package/scripts/ams.py |   73 +
 .../services/AMS/package/scripts/ams_service.py |   72 +
 .../services/AMS/package/scripts/functions.py   |   40 +
 .../2.2/services/AMS/package/scripts/hbase.py   |   76 +-
 .../AMS/package/scripts/hbase_service.py        |    2 +-
 .../AMS/package/scripts/metric_collector.py     |   63 +
 .../AMS/package/scripts/metric_monitor.py       |   61 +
 .../2.2/services/AMS/package/scripts/params.py  |  107 +-
 .../AMS/package/scripts/service_check.py        |   19 +
 .../AMS/package/scripts/status_params.py        |   30 +
 .../AMS/package/templates/metric_groups.conf.j2 |   55 +
 .../AMS/package/templates/metric_monitor.ini.j2 |   30 +
 46 files changed, 1814 insertions(+), 5995 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml b/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml
index 310a53f..7fd898c 100644
--- a/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml
+++ b/ambari-metrics/ambari-metrics-hadoop-sink/pom.xml
@@ -22,14 +22,29 @@ limitations under the License.
   <parent>
     <artifactId>ambari-metrics</artifactId>
     <groupId>org.apache.ambari</groupId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>0.1.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <artifactId>ambari-metrics-hadoop-sink</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <build>
     <plugins>
       <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>copy-dependencies</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${project.build.directory}/lib</outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
           <descriptors>
@@ -78,6 +93,54 @@ limitations under the License.
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>com.github.goldin</groupId>
+        <artifactId>copy-maven-plugin</artifactId>
+        <version>0.2.5</version>
+        <executions>
+          <execution>
+            <id>create-archive</id>
+            <phase>none</phase>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rpm-maven-plugin</artifactId>
+        <version>2.0.1</version>
+        <executions>
+          <execution>
+            <phase>none</phase>
+            <goals>
+              <goal>rpm</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <name>ambari-metrics-hadoop-sink</name>
+          <copyright>2012, Apache Software Foundation</copyright>
+          <group>Development</group>
+          <description>Maven Recipe: RPM Package.</description>
+          <mappings>
+            <mapping>
+              <directory>/usr/lib/hadoop/lib</directory>
+              <filemode>644</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <sources>
+                <source>
+                  <location>target/${project.artifactId}-${project.version}.jar</location>
+                </source>
+                <source>
+                  <location>target/lib</location>
+                </source>
+              </sources>
+
+            </mapping>
+
+          </mappings>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -91,16 +154,19 @@ limitations under the License.
     <dependency>
       <groupId>commons-httpclient</groupId>
       <artifactId>commons-httpclient</artifactId>
+      <version>3.1</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
+      <version>1.8</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
+      <version>2.1</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
@@ -112,6 +178,7 @@ limitations under the License.
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
+      <version>1.1.1</version>
     </dependency>
     <dependency>
       <groupId>commons-configuration</groupId>
@@ -122,11 +189,13 @@ limitations under the License.
     <dependency>
       <groupId>org.codehaus.jackson</groupId>
       <artifactId>jackson-core-asl</artifactId>
+      <version>1.9.9</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.jackson</groupId>
       <artifactId>jackson-mapper-asl</artifactId>
+      <version>1.9.13</version>
     </dependency>
   </dependencies>
 
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ambari-metrics-collector
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ambari-metrics-collector b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ambari-metrics-collector
new file mode 100644
index 0000000..eed1c9c
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ambari-metrics-collector
@@ -0,0 +1,269 @@
+#!/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
+
+#JAVA_HOME=/usr/jdk64/jdk1.7.0_45
+PIDFILE=/var/run/ambari-metrics-collector/ambari-metrics-collector.pid
+OUTFILE=/var/log/ambari-metrics-collector/ambari-metrics-collector.out
+
+HBASE_ZK_PID=/var/run/ams-hbase/hbase-hbase-zookeeper.pid
+HBASE_MASTER_PID=/var/run/ams-hbase/hbase-hbase-master.pid
+HBASE_RS_PID=/var/run/ams-hbase/hbase-hbase-regionserver.pid
+
+HBASE_DIR=/usr/lib/ams-hbase
+
+DAEMON_NAME=timelineserver
+
+COLLECTOR_CONF_DIR=/etc/ambari-metrics-collector/conf
+HBASE_CONF_DIR=${COLLECTOR_CONF_DIR}
+
+METRIC_COLLECTOR=ambari-metrics-collector
+
+STOP_TIMEOUT=5
+
+function hbase_daemon
+{
+    local daemon=$1
+    local cmd=$2
+    local pid
+
+    case "${daemon}" in
+      "master")
+        pid=${HBASE_MASTER_PID}
+      ;;
+      "zookeeper")
+        pid=${HBASE_ZK_PID}
+      ;;
+      "regionserver")
+        pid=${HBASE_RS_PID}
+      ;;
+    esac
+
+    daemon_status "${pid}"
+    if [[ $? == 0  ]]; then
+        echo "${daemon} is running as process $(cat "${pid}"). Continuing"
+      else
+        # stale pid file, so just remove it and continue on
+        rm -f "${pid}" >/dev/null 2>&1
+    fi
+
+    ${HBASE_DIR}/bin/hbase-daemon.sh --config ${HBASE_CONF_DIR} ${cmd} ${daemon}
+
+
+
+}
+
+function write_pidfile
+{
+    local pidfile="$1"
+    echo $! > "${pidfile}" 2>/dev/null
+    if [[ $? -gt 0 ]]; then
+      echo "ERROR:  Cannot write pid ${pidfile}."
+      exit 1;
+    fi
+}
+
+function hadoop_java_setup
+{
+  # Bail if we did not detect it
+  if [[ -z "${JAVA_HOME}" ]]; then
+    echo "ERROR: JAVA_HOME is not set and could not be found."
+    exit 1
+  fi
+
+  if [[ ! -d "${JAVA_HOME}" ]]; then
+    echo "ERROR: JAVA_HOME ${JAVA_HOME} does not exist."
+    exit 1
+  fi
+
+  JAVA="${JAVA_HOME}/bin/java"
+
+  if [[ ! -x "$JAVA" ]]; then
+    echo "ERROR: $JAVA is not executable."
+    exit 1
+  fi
+  # shellcheck disable=SC2034
+  JAVA_HEAP_MAX=-Xmx1g
+  HADOOP_HEAPSIZE=${HADOOP_HEAPSIZE:-1024}
+
+  # check envvars which might override default args
+  if [[ -n "$HADOOP_HEAPSIZE" ]]; then
+    # shellcheck disable=SC2034
+    JAVA_HEAP_MAX="-Xmx${HADOOP_HEAPSIZE}m"
+  fi
+}
+
+function daemon_status()
+{
+  #
+  # LSB 4.1.0 compatible status command (1)
+  #
+  # 0 = program is running
+  # 1 = dead, but still a pid (2)
+  # 2 = (not used by us)
+  # 3 = not running
+  #
+  # 1 - this is not an endorsement of the LSB
+  #
+  # 2 - technically, the specification says /var/run/pid, so
+  #     we should never return this value, but we're giving
+  #     them the benefit of a doubt and returning 1 even if
+  #     our pid is not in in /var/run .
+  #
+
+  local pidfile="$1"
+  shift
+
+  local pid
+
+  if [[ -f "${pidfile}" ]]; then
+    pid=$(cat "${pidfile}")
+    if ps -p "${pid}" > /dev/null 2>&1; then
+      return 0
+    fi
+    return 1
+  fi
+  return 3
+}
+
+while [[ -z "${_ams_configs_done}" ]]; do
+  case $1 in
+    --config)
+      shift
+      confdir=$1
+      shift
+      if [[ -d "${confdir}" ]]; then
+        COLLECTOR_CONF_DIR="${confdir}"
+      elif [[ -z "${confdir}" ]]; then
+        echo "ERROR: No parameter provided for --config "
+        exit 1
+      else
+        echo "ERROR: Cannot find configuration directory \"${confdir}\""
+        exit 1
+      fi
+    ;;
+    *)
+      _ams_configs_done=true
+    ;;
+  esac
+done
+
+#execute ams-env.sh
+if [[ -f "${COLLECTOR_CONF_DIR}/ams-env.sh" ]]; then
+  . "${COLLECTOR_CONF_DIR}/ams-env.sh"
+else
+  echo "ERROR: Cannot execute ${COLLECTOR_CONF_DIR}/ams-env.sh." 2>&1
+  exit 1
+fi
+
+#TODO manage 3 hbase daemons for start/stop/status
+case "$1" in
+
+	start)
+		hadoop_java_setup
+
+		#hbase_daemon "zookeeper" "start"
+
+		hbase_daemon "master" "start"
+		#hbase_daemon "regionserver" "start"
+
+    sleep 30
+
+		CLASS='org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryServer'
+		# YARN_OPTS="${YARN_OPTS} ${YARN_TIMELINESERVER_OPTS}"
+		# if [[ -n "${YARN_TIMELINESERVER_HEAPSIZE}" ]]; then
+		#   JAVA_HEAP_MAX="-Xmx${YARN_TIMELINESERVER_HEAPSIZE}m"
+		# fi
+		
+		# check if this is needed?
+		# export PHOENIX_JAR_PATH=/usr/lib/ambari-metrics/timelineservice/phoenix-client.jar
+		# export HBASE_CONF_DIR=${HBASE_DIR}/conf
+
+    daemon_status "${PIDFILE}"
+    if [[ $? == 0  ]]; then
+        echo "AMS is running as process $(cat "${PIDFILE}"). Exiting"
+        exit 1
+    else
+        # stale pid file, so just remove it and continue on
+        rm -f "${PIDFILE}" >/dev/null 2>&1
+    fi
+
+    nohup "${JAVA}" "-cp" "/usr/lib/ambari-metrics-collector/*:${COLLECTOR_CONF_DIR}" "-Dproc_${DAEMON_NAME}" "${CLASS}" "$@" > $OUTFILE 2>&1 &
+    PID=$!
+    write_pidfile "${PIDFILE}"
+    sleep 2
+
+    echo "Verifying ${METRIC_COLLECTOR} process status..."
+    if [ -z "`ps ax -o pid | grep ${PID}`" ]; then
+      if [ -s ${OUTFILE} ]; then
+        echo "ERROR: ${METRIC_COLLECTOR} start failed. For more details, see ${OUTFILE}:"
+        echo "===================="
+        tail -n 10 ${OUTFILE}
+        echo "===================="
+      else
+        echo "ERROR: ${METRIC_COLLECTOR} start failed"
+        rm -f ${PIDFILE}
+      fi
+      echo "Collector out at: ${OUTFILE}"
+      exit -1
+    fi
+
+    echo "Collector successfully started."
+
+  ;;
+	stop)
+	    pidfile=${PIDFILE}
+
+	    if [[ -f "${pidfile}" ]]; then
+          pid=$(cat "$pidfile")
+
+          kill "${pid}" >/dev/null 2>&1
+          sleep "${STOP_TIMEOUT}"
+
+          if kill -0 "${pid}" > /dev/null 2>&1; then
+            echo "WARNING: ${METRIC_COLLECTOR} did not stop gracefully after ${STOP_TIMEOUT} seconds: Trying to kill with kill -9"
+            kill -9 "${pid}" >/dev/null 2>&1
+          fi
+
+          if ps -p "${pid}" > /dev/null 2>&1; then
+            echo "ERROR: Unable to kill ${pid}"
+          else
+            rm -f "${pidfile}" >/dev/null 2>&1
+          fi
+      fi
+
+      #stop hbase daemons
+      #hbase_daemon "zookeeper" "stop"
+      hbase_daemon "master" "stop"
+      #hbase_daemon "regionserver" "stop"
+
+
+    ;;
+	status)
+	    daemon_status "${PIDFILE}"
+	    if [[ $? == 0  ]]; then
+            echo "AMS is running as process $(cat "${PIDFILE}")."
+        else
+            echo "AMS is not running."
+        fi
+        #print embedded hbase daemons statuses?
+    ;;
+	restart)
+	;;
+
+esac
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-env.sh
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-env.sh b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-env.sh
new file mode 100644
index 0000000..9928093
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-env.sh
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set environment variables here.

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-site.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-site.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-site.xml
new file mode 100644
index 0000000..c2dd100
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/conf/unix/ams-site.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<configuration>
+
+  <!-- Site specific AMS configuration properties -->
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/pom.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/pom.xml
index 51a7de7..06f84be 100644
--- a/ambari-metrics/ambari-metrics-hadoop-timelineservice/pom.xml
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/pom.xml
@@ -22,18 +22,17 @@
   <parent>
     <artifactId>ambari-metrics</artifactId>
     <groupId>org.apache.ambari</groupId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>0.1.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
-  <groupId>org.apache.hadoop</groupId>
   <artifactId>ambari-metrics-hadoop-timelineservice</artifactId>
-  <version>1.3.0-SNAPSHOT</version>
+  <version>0.1.0-SNAPSHOT</version>
   <name>ambari-metrics-hadoop-timelineservice</name>
   <packaging>jar</packaging>
 
   <properties>
     <!-- Needed for generating FindBugs warnings using parent pom -->
-    <yarn.basedir>${project.parent.parent.basedir}</yarn.basedir>
+    <!--<yarn.basedir>${project.parent.parent.basedir}</yarn.basedir>-->
     <protobuf.version>2.5.0</protobuf.version>
     <hadoop.version>2.4.0</hadoop.version>
   </properties>
@@ -63,34 +62,183 @@
       </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
-        <configuration>
-          <descriptors>
-            <descriptor>src/main/assemblies/ats.xml</descriptor>
-          </descriptors>
-          <tarLongFileMode>gnu</tarLongFileMode>
-        </configuration>
         <executions>
           <execution>
+            <configuration>
+              <descriptors>
+                <descriptor>src/main/assemblies/ats.xml</descriptor>
+              </descriptors>
+              <tarLongFileMode>gnu</tarLongFileMode>
+            </configuration>
             <id>build-tarball</id>
             <phase>none</phase>
             <goals>
               <goal>single</goal>
             </goals>
           </execution>
+
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>com.github.goldin</groupId>
+        <artifactId>copy-maven-plugin</artifactId>
+        <version>0.2.5</version>
+        <executions>
+          <execution>
+            <id>create-archive</id>
+            <phase>package</phase>
+            <goals>
+              <goal>copy</goal>
+            </goals>
+            <configuration>
+              <resources>
+                <resource>
+                  <targetPath>${project.build.directory}/embedded</targetPath>
+                  <file>${hbase.tar}</file>
+                  <unpack>true</unpack>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>rpm-maven-plugin</artifactId>
+        <version>2.0.1</version>
+        <executions>
+          <execution>
+            <!-- unbinds rpm creation from maven lifecycle -->
+            <phase>none</phase>
+            <goals>
+              <goal>rpm</goal>
+            </goals>
+          </execution>
         </executions>
+        <configuration>
+          <name>ambari-metrics-collector</name>
+          <copyright>2012, Apache Software Foundation</copyright>
+          <group>Development</group>
+          <description>Maven Recipe: RPM Package.</description>
+          <autoRequires>false</autoRequires>
+          <requires>
+            <require>${python.ver}</require>
+          </requires>
+
+          <defaultFilemode>644</defaultFilemode>
+          <defaultDirmode>755</defaultDirmode>
+          <defaultUsername>root</defaultUsername>
+          <defaultGroupname>root</defaultGroupname>
+
+          <mappings>
+            <mapping>
+              <!--jars-->
+              <directory>/usr/lib/ambari-metrics-collector/</directory>
+              <sources>
+                <source>
+                  <location>target/lib</location>
+                </source>
+                <source>
+                  <location>${project.build.directory}/${project.artifactId}-${project.version}.jar</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <!--embedded applications-->
+              <directory>/usr/lib/ams-hbase/</directory>
+              <sources>
+                <source>
+                  <location>target/embedded/${hbase.folder}</location>
+                  <excludes>
+                    <exclude>target/embedded/${hbase.folder}/bin/*</exclude>
+                  </excludes>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/usr/lib/ams-hbase/bin</directory>
+              <filemode>755</filemode>
+              <sources>
+                <source>
+                  <location>target/embedded/${hbase.folder}/bin</location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/usr/lib/ams-hbase/lib/</directory>
+              <sources>
+                <source>
+                  <location>target/lib</location>
+                  <includes>
+                    <include>phoenix*.jar</include>
+                    <include>antlr*.jar</include>
+                  </includes>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/usr/sbin</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <source>
+                  <location>conf/unix/ambari-metrics-collector</location>
+                  <filter>true</filter>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>/etc/ambari-metrics-collector/conf</directory>
+              <configuration>true</configuration>
+            </mapping>
+            <mapping>
+              <directory>/etc/ams-hbase/conf</directory>
+              <configuration>true</configuration>
+            </mapping>
+            <mapping>
+              <directory>/var/run/ams-hbase</directory>
+            </mapping>
+            <mapping>
+              <directory>/var/run/ambari-metrics-collector</directory>
+            </mapping>
+            <mapping>
+              <directory>/var/log/ambari-metrics-collector</directory>
+            </mapping>
+            <mapping>
+              <directory>/var/lib/ambari-metrics-collector</directory>
+            </mapping>
+          </mappings>
+        </configuration>
       </plugin>
+
     </plugins>
   </build>
 
   <dependencies>
     <dependency>
+      <groupId>org.apache.phoenix</groupId>
+      <artifactId>phoenix-core</artifactId>
+      <version>4.2.0.2.2.0.0-2038</version>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.5</version>
+    </dependency>
+
+    <dependency>
       <artifactId>ambari-metrics-hadoop-sink</artifactId>
       <groupId>org.apache.ambari</groupId>
-      <version>1.3.0-SNAPSHOT</version>
+      <version>0.1.0-SNAPSHOT</version>
     </dependency>
+
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
+      <version>2.5</version>
     </dependency>
     <!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
     <dependency>
@@ -141,6 +289,7 @@
     <dependency>
       <groupId>com.google.inject.extensions</groupId>
       <artifactId>guice-servlet</artifactId>
+      <version>3.0</version>
     </dependency>
     <dependency>
       <groupId>com.google.protobuf</groupId>
@@ -151,24 +300,29 @@
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
+      <version>4.10</version>
     </dependency>
     <!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
     <dependency>
       <groupId>com.google.inject</groupId>
       <artifactId>guice</artifactId>
+      <version>3.0</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey.jersey-test-framework</groupId>
       <artifactId>jersey-test-framework-core</artifactId>
+      <version>1.11</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-json</artifactId>
+      <version>1.11</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey.contribs</groupId>
       <artifactId>jersey-guice</artifactId>
+      <version>1.11</version>
     </dependency>
     <!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
     <dependency>
@@ -198,22 +352,27 @@
     <dependency>
       <groupId>org.codehaus.jettison</groupId>
       <artifactId>jettison</artifactId>
+      <version>1.1</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-core</artifactId>
+      <version>1.11</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-client</artifactId>
+      <version>1.11</version>
     </dependency>
     <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
+      <version>14.0.1</version>
     </dependency>
     <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
+      <version>1.1.1</version>
     </dependency>
 
     <!-- 'mvn dependency:analyze' fails to detect use of this dependency -->
@@ -228,15 +387,31 @@
       <groupId>com.sun.jersey.jersey-test-framework</groupId>
       <artifactId>jersey-test-framework-grizzly2</artifactId>
       <scope>test</scope>
+      <version>1.11</version>
     </dependency>
 
     <dependency>
       <groupId>org.codehaus.jackson</groupId>
       <artifactId>jackson-core-asl</artifactId>
+      <version>1.9.9</version>
     </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.7.2</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.7.2</version>
+    </dependency>
+
     <dependency>
       <groupId>org.codehaus.jackson</groupId>
       <artifactId>jackson-mapper-asl</artifactId>
+      <version>1.9.13</version>
     </dependency>
 
     <dependency>
@@ -267,11 +442,6 @@
     <!-- for unit tests only -->
     <dependency>
       <groupId>org.apache.phoenix</groupId>
-      <artifactId>phoenix-core</artifactId>
-      <version>4.2.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.phoenix</groupId>
       <artifactId>phoenix-core-tests</artifactId>
       <version>4.2.0</version>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-client.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-client.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-client.xml
new file mode 100644
index 0000000..beca5bd
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-client.xml
@@ -0,0 +1,62 @@
+<?xml version='1.0'?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <id>client</id>
+  <!-- All the dependencies (unpacked) necessary to run phoenix from a single, stand-alone jar -->
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+
+  <componentDescriptors>
+    <componentDescriptor>src/main/assemblies/phoenix-components-minimal.xml</componentDescriptor>
+    <componentDescriptor>src/main/assemblies/phoenix-components-major-client.xml</componentDescriptor>
+  </componentDescriptors>
+
+  <dependencySets>
+    <dependencySet>
+      <!-- Unpack all the dependencies to class files, since java doesn't support
+        jar of jars for running -->
+      <unpack>true</unpack>
+      <!-- save these dependencies to the top-level -->
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>jline:jline</include>
+        <include>sqlline:sqlline</include>
+        <include>org.apache.hbase:hbase*</include>
+        <include>org.cloudera.htrace:htrace-core</include>
+        <include>io.netty:netty</include>
+        <include>commons-codec:commons-codec</include>
+      </includes>
+    </dependencySet>
+
+    <!-- Make sure we get all the components, not just the minimal client ones (e.g.
+      phoenix-flume, phoenix-pig, etc) -->
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <includes>
+        <include>org.apache.phoenix:phoenix-*</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-major-client.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-major-client.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-major-client.xml
new file mode 100644
index 0000000..13692fe
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-major-client.xml
@@ -0,0 +1,53 @@
+<?xml version='1.0'?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<component>
+  <!-- Components that the client needs (except for HBase) -->
+  <dependencySets>
+    <dependencySet>
+      <!-- Unpack all the dependencies to class files, since java doesn't support
+        jar of jars for running -->
+      <unpack>true</unpack>
+      <!-- save these dependencies to the top-level -->
+      <outputDirectory>/</outputDirectory>
+      <!-- Maybe a blacklist is easier? -->
+      <includes>
+        <!-- We use a newer version of guava than HBase - this might be an issue? -->
+        <include>com.google.guava:guava</include>
+        <!-- HBase also pulls in these dependencies on its own, should we include-them? -->
+        <include>com.google.protobuf:protobuf-java</include>
+        <include>org.slf4j:slf4j-api</include>
+        <include>org.slf4j:slf4j-log4j12</include>
+        <include>org.apache.zookeeper:zookeeper</include>
+        <include>log4j:log4j</include>
+        <include>org.apache.hadoop:hadoop*</include>
+        <include>commons-configuration:commons-configuration</include>
+        <include>commons-io:commons-io</include>
+        <include>commons-logging:commons-logging</include>
+        <include>commons-lang:commons-lang</include>
+        <include>commons-cli:commons-cli</include>
+        <include>org.apache.commons:commons-csv</include>
+        <include>org.codehaus.jackson:jackson-mapper-asl</include>
+        <include>org.codehaus.jackson:jackson-core-asl</include>
+        <include>org.xerial.snappy:snappy-java</include>
+        <include>commons-collections:commons-collections</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-minimal.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-minimal.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-minimal.xml
new file mode 100644
index 0000000..bf7de85
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-components-minimal.xml
@@ -0,0 +1,71 @@
+<?xml version='1.0'?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<component>
+  <!-- Just the basic components that Phoenix pulls in, that is not a transitive dependency from Hadoop/HBase/Pig -->
+  <dependencySets>
+    <dependencySet>
+      <!-- Unpack all the dependencies to class files, since java doesn't support
+        jar of jars for running -->
+      <unpack>true</unpack>
+      <!-- save these dependencies to the top-level -->
+      <outputDirectory>/</outputDirectory>
+      <!-- Just include the extra things that phoenix needs -->
+      <includes>
+        <include>org.antlr:antlr*</include>
+      </includes>
+    </dependencySet>
+
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <includes>
+        <include>org.apache.phoenix:phoenix-*</include>
+      </includes>
+      <excludes>
+        <exclude>org.apache.phoenix:phoenix-flume</exclude>
+        <exclude>org.apache.phoenix:phoenix-pig</exclude>
+      </excludes>
+    </dependencySet>
+  </dependencySets>
+
+  <fileSets>
+    <fileSet>
+      <!--Get misc project files -->
+      <directory>${project.basedir}/..</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>*.txt*</include>
+        <include>*.md</include>
+        <include>NOTICE*</include>
+      </includes>
+      <excludes>
+        <exclude>build.txt</exclude>
+      </excludes>
+    </fileSet>
+    <fileSet>
+      <!--Get map-red-config properties files -->
+      <directory>${project.basedir}/../config</directory>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>csv-bulk-load-config.properties</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</component>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-server.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-server.xml b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-server.xml
new file mode 100644
index 0000000..be8a516
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-hadoop-timelineservice/src/main/assemblies/phoenix-server.xml
@@ -0,0 +1,46 @@
+<?xml version='1.0'?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+  <!-- build the phoenix server side jar, that includes phoenix-hadoopX-compat, phoenix-hadoop-compat and antlr -->
+  <id>server</id>
+  <formats>
+    <format>jar</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory>/</outputDirectory>
+      <unpack>true</unpack>
+      <includes>
+        <include>org.apache.phoenix:phoenix-core</include>
+        <include>org.apache.phoenix:phoenix-hadoop*</include>
+      </includes>
+    </dependencySet>
+    <dependencySet>
+      <unpack>true</unpack>
+      <outputDirectory>/</outputDirectory>
+      <includes>
+        <include>org.antlr:antlr*</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>
+</assembly>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor
new file mode 100644
index 0000000..45e7a44
--- /dev/null
+++ b/ambari-metrics/ambari-metrics-host-monitoring/conf/unix/ambari-metrics-monitor
@@ -0,0 +1,202 @@
+#!/bin/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
+#
+#     ht${PYTHON}w.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
+
+
+MONITOR_CONF_DIR=/etc/ambari-metrics-monitor/conf/
+METRIC_MONITOR=ambari-metrics-monitor
+
+RESOURCE_MONITORING_DIR=/usr/lib/python2.6/site-packages/resource_monitoring
+METRIC_MONITOR_PY_SCRIPT=${RESOURCE_MONITORING_DIR}/main.py
+
+PIDFILE=/var/run/ambari-metrics-monitor/ambari-metrics-monitor.pid
+OUTFILE=/var/log/ambari-metrics-monitor/ambari-metrics-monitor.out
+
+STOP_TIMEOUT=5
+
+OK=0
+NOTOK=1
+
+if [ -a /usr/bin/python2.7 ] && [ -z "${PYTHON}" ]; then
+  PYTHON=/usr/bin/python2.7
+fi
+
+if [ -a /usr/bin/python2.6 ] && [ -z "${PYTHON}" ]; then
+  PYTHON=/usr/bin/python2.6
+fi
+
+if [ "x$PYTHON" == "x" ]; then
+  PYTHON=/usr/bin/python
+fi
+
+export PYTHON=${PYTHON}
+
+check_python_version ()
+{
+  echo "Verifying Python version compatibility..."
+  majversion=`${PYTHON} -V 2>&1 | awk '{print $2}' | cut -d'.' -f1`
+  minversion=`${PYTHON} -V 2>&1 | awk '{print $2}' | cut -d'.' -f2`
+  numversion=$(( 10 * $majversion + $minversion))
+  if (( $numversion < 26 )); then
+    echo "ERROR: Found Python version $majversion.$minversion. Ambari Metric Monitor requires Python version > 2.6"
+    return ${NOTOK}
+  fi
+  echo "Using python " ${PYTHON}
+  return ${OK}
+}
+
+function write_pidfile
+{
+    local pidfile="$1"
+    echo $! > "${pidfile}" 2>/dev/null
+    if [[ $? -gt 0 ]]; then
+      echo "ERROR:  Cannot write pid ${pidfile}."
+      exit 1;
+    fi
+}
+
+#build psutil
+if [ ! "$(ls -A ${RESOURCE_MONITORING_DIR}/psutil/build)" ]; then
+  echo "Building psutil..."
+  dir=$(pwd)
+  cd "${RESOURCE_MONITORING_DIR}/psutil"
+  ${PYTHON} "build.py"
+  cd "${dir}"
+else
+  echo "psutil build directory is not empty, continuing..."
+fi
+
+#locate config dir
+while [[ -z "${_ams_configs_done}" ]]; do
+  case $1 in
+    --config)
+      shift
+      confdir=$1
+      shift
+      if [[ -d "${confdir}" ]]; then
+        MONITOR_CONF_DIR="${confdir}"
+      elif [[ -z "${confdir}" ]]; then
+        echo "ERROR: No parameter provided for --config "
+        exit 1
+      else
+        echo "ERROR: Cannot find configuration directory \"${confdir}\""
+        exit 1
+      fi
+    ;;
+    *)
+      _ams_configs_done=true
+    ;;
+  esac
+done
+
+case "$1" in
+
+  start)
+    check_python_version
+    if [ "$?" -eq "${NOTOK}" ]; then
+          exit -1
+    fi
+
+    echo "Checking for previously running Metric Monitor..."
+    if [ -f ${PIDFILE} ]; then
+      PID=`cat ${PIDFILE}`
+      if [ -z "`ps ax -o pid | grep ${PID}`" ]; then
+        echo "${PIDFILE} found with no process. Removing ${PID}..."
+        rm -f ${PIDFILE}
+      else
+        tput bold
+        echo "ERROR: ${METRIC_MONITOR} already running"
+        tput sgr0
+        echo "Check ${PIDFILE} for PID."
+        exit -1
+      fi
+    fi
+
+    echo "Starting ${METRIC_MONITOR}"
+
+    nohup ${PYTHON} ${METRIC_MONITOR_PY_SCRIPT} "$@" > ${OUTFILE} 2>&1 &
+    PID=$!
+    write_pidfile ${PIDFILE}
+
+    sleep 2
+
+    echo "Verifying ${METRIC_MONITOR} process status..."
+    if [ -z "`ps ax -o pid | grep ${PID}`" ]; then
+      if [ -s ${OUTFILE} ]; then
+        echo "ERROR: ${METRIC_MONITOR} start failed. For more details, see ${OUTFILE}:"
+        echo "===================="
+        tail -n 10 ${OUTFILE}
+        echo "===================="
+      else
+        echo "ERROR: ${METRIC_MONITOR} start failed"
+        rm -f ${PIDFILE}
+      fi
+      echo "Monitor out at: ${OUTFILE}"
+      exit -1
+    fi
+
+    echo "Metric Monitor successfully started"
+  ;;
+  status)
+    if [ -f ${PIDFILE} ]; then
+      PID=`cat ${PIDFILE}`
+      echo "Found ${METRIC_MONITOR} PID: $PID"
+      if [ -z "`ps ax -o pid | grep ${PID}`" ]; then
+        echo "${METRIC_MONITOR} not running. Stale PID File at: $PIDFILE"
+        retcode=2
+      else
+        tput bold
+        echo "${METRIC_MONITOR} running."
+        tput sgr0
+        echo "Monitor PID at: ${PIDFILE}"
+        echo "Monitor out at: ${OUTFILE}"
+      fi
+    else
+      tput bold
+      echo "${METRIC_MONITOR} currently not running"
+      tput sgr0
+      echo "Usage: /usr/sbin/${METRIC_MONITOR} {start|stop|restart|status}"
+      retcode=3
+    fi
+  ;;
+  stop)
+    pidfile=${PIDFILE}
+
+    if [[ -f "${pidfile}" ]]; then
+        pid=$(cat "$pidfile")
+
+        kill "${pid}" >/dev/null 2>&1
+        sleep "${STOP_TIMEOUT}"
+
+        if kill -0 "${pid}" > /dev/null 2>&1; then
+          echo "WARNING: ${METRIC_MONITOR} did not stop gracefully after ${STOP_TIMEOUT} seconds: Trying to kill with kill -9"
+          kill -9 "${pid}" >/dev/null 2>&1
+        fi
+
+        if ps -p "${pid}" > /dev/null 2>&1; then
+          echo "ERROR: Unable to kill ${pid}"
+        else
+          rm -f "${pidfile}" >/dev/null 2>&1
+        fi
+    fi
+
+  ;;
+  restart)
+    echo -e "Restarting ${METRIC_MONITOR}"
+    $0 stop
+    $0 start "$@"
+    retcode=$?
+  ;;
+esac

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/pom.xml b/ambari-metrics/ambari-metrics-host-monitoring/pom.xml
index 20c6642..0dac918 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/pom.xml
+++ b/ambari-metrics/ambari-metrics-host-monitoring/pom.xml
@@ -22,11 +22,11 @@
   <parent>
     <artifactId>ambari-metrics</artifactId>
     <groupId>org.apache.ambari</groupId>
-    <version>1.3.0-SNAPSHOT</version>
+    <version>0.1.0-SNAPSHOT</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <packaging>pom</packaging>
-  <version>1.3.0-SNAPSHOT</version>
+  <version>0.1.0-SNAPSHOT</version>
   <artifactId>ambari-metrics-host-monitoring</artifactId>
   <properties>
     <resmonitor.install.dir>
@@ -36,6 +36,21 @@
   <build>
     <plugins>
       <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.6</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${project.basedir}/src/main/python/psutil/build/</directory>
+              <includes>
+                <include>**/*</include>
+              </includes>
+              <followSymlinks>false</followSymlinks>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
         <version>1.8</version>
@@ -71,13 +86,13 @@
         <configuration>
           <tarLongFileMode>gnu</tarLongFileMode>
           <descriptors>
-            <descriptor>src/packages/tarball/all.xml</descriptor>
+            <descriptor>${project.basedir}/../../ambari-project/src/main/assemblies/empty.xml</descriptor>
           </descriptors>
         </configuration>
         <executions>
           <execution>
             <id>build-tarball</id>
-            <phase>prepare-package</phase>
+            <phase>none</phase>
             <goals>
               <goal>single</goal>
             </goals>
@@ -86,29 +101,6 @@
       </plugin>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
-        <artifactId>exec-maven-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <configuration>
-              <executable>python</executable>
-              <workingDirectory>
-                ${basedir}/src/main/python/resource_monitoring/psutil
-              </workingDirectory>
-              <arguments>
-                <argument>build.py</argument>
-              </arguments>
-            </configuration>
-            <id>generate-psutil-binaries</id>
-            <phase>package</phase>
-            <goals>
-              <goal>exec</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
         <artifactId>rpm-maven-plugin</artifactId>
         <version>2.0.1</version>
         <executions>
@@ -122,9 +114,16 @@
         </executions>
 
         <configuration>
+          <name>ambari-metrics-monitor</name>
           <group>Development</group>
           <needarch>x86_64</needarch>
           <autoRequires>false</autoRequires>
+          <requires>
+            <require>ambari-metrics-hadoop-sink</require>
+            <require>${python.ver}</require>
+            <require>gcc</require>
+            <require>python-devel</require>
+          </requires>
           <mappings>
             <mapping>
               <directory>${resmonitor.install.dir}</directory>
@@ -132,21 +131,72 @@
               <groupname>root</groupname>
               <sources>
                 <source>
+                  <!--<location>-->
+                  <!--${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/external/build/*-->
+                  <!--</location>-->
+                  <!--<location>-->
+                  <!--${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/core-->
+                  <!--</location>-->
+                  <!--<location>-->
+                  <!--${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/__init__.py-->
+                  <!--</location>-->
                   <location>
-                    ${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/external/build/*
+                    ${project.basedir}/src/main/python/__init__.py
                   </location>
+                </source>
+                <source>
+                  <location>
+                    ${project.basedir}/src/main/python/main.py
+                  </location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${resmonitor.install.dir}/core</directory>
+              <sources>
+                <source>
                   <location>
-                    ${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/core
+                    ${project.basedir}/src/main/python/core
                   </location>
+                </source>
+              </sources>
+            </mapping>
+            <mapping>
+              <directory>${resmonitor.install.dir}/psutil</directory>
+              <sources>
+                <source>
                   <location>
-                    ${project.build.directory}/${project.artifactId}-${project.version}/resource_monitoring/__init__.py
+                    ${project.basedir}/src/main/python/psutil
                   </location>
                 </source>
               </sources>
             </mapping>
+            <mapping>
+              <directory>/etc/ambari-metrics-monitor/conf</directory>
+              <configuration>true</configuration>
+            </mapping>
+            <mapping>
+              <directory>/var/run/ambari-metrics-monitor</directory>
+            </mapping>
+            <mapping>
+              <directory>/var/log/ambari-metrics-monitor</directory>
+            </mapping>
+            <mapping>
+              <directory>/usr/sbin</directory>
+              <filemode>755</filemode>
+              <username>root</username>
+              <groupname>root</groupname>
+              <directoryIncluded>false</directoryIncluded>
+              <sources>
+                <source>
+                  <location>conf/unix/ambari-metrics-monitor</location>
+                  <filter>true</filter>
+                </source>
+              </sources>
+            </mapping>
           </mappings>
         </configuration>
       </plugin>
     </plugins>
   </build>
-</project>
\ No newline at end of file
+</project>

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/__init__.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/__init__.py
index 38daf22..adfc71c 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/__init__.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/__init__.py
@@ -18,4 +18,4 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-from resource_monitoring.core import *
+from core import *

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/__init__.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/__init__.py
index 1629c9f..996120f 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/__init__.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/__init__.py
@@ -18,7 +18,6 @@ limitations under the License.
 
 """
 
-from resource_monitoring.core import *
 import os, sys
 path = os.path.abspath(__file__)
 path = os.path.join(os.path.dirname(os.path.dirname(path)), "psutil/build/")

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
index 7726925..daabf37 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/config_reader.py
@@ -24,8 +24,8 @@ import json
 import os
 
 config = ConfigParser.RawConfigParser()
-CONFIG_FILE_PATH = "/etc/metric-monitor/conf/metric_monitor.ini"
-METRIC_FILE_PATH = "/etc/metric-monitor/conf/metric_groups.conf"
+CONFIG_FILE_PATH = "/etc/ambari-metrics-monitor/conf/metric_monitor.ini"
+METRIC_FILE_PATH = "/etc/ambari-metrics-monitor/conf/metric_groups.conf"
 
 config_content = """
 [default]
@@ -124,4 +124,4 @@ class Configuration:
     return self.get("default", "debug_level", "INFO")
 
   def get_max_queue_size(self):
-    return int(self.get("collector", "max_queue_size", 5000))
\ No newline at end of file
+    return int(self.get("collector", "max_queue_size", 5000))

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/emitter.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/emitter.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/emitter.py
index c907445..a107374 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/emitter.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/emitter.py
@@ -55,7 +55,7 @@ class Emitter(threading.Thread):
           pass
           response = self.push_metrics(json_data)
 
-          if response and response.status == '201':
+          if response and response.getcode() == '200':
             retry_count = MAX_RETRY_COUNT
             self.application_metric_map.clear()
             self.application_metric_map.release_lock()
@@ -82,8 +82,7 @@ class Emitter(threading.Thread):
     req = urllib2.Request(server, data, headers)
     response = urllib2.urlopen(req, timeout=int(self.send_interval - 10))
     if response:
-      logger.debug("POST response from server: status = {0}, code = {1}".format(
-        response.status, response.reason))
+      logger.debug("POST response from server: retcode = {0}".format(response.getcode()))
       logger.debug(response.read())
     pass
     return response

http://git-wip-us.apache.org/repos/asf/ambari/blob/a3ed7a3f/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
index 0a54d6b..365e1df 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-import resource_monitoring.core
+import core
 from core.controller import Controller, Configuration
 import logging
 import signal
@@ -33,7 +33,7 @@ def main(argv=None):
   config = Configuration()
   collector = Controller(config)
 
-  logger.setLevel(config.get_log_level())
+  logger.setLevel(logging.DEBUG)
   formatter = logging.Formatter("%(asctime)s %(filename)s:%(lineno)d - %(message)s")
   stream_handler = logging.StreamHandler()
   stream_handler.setFormatter(formatter)


Mime
View raw message