You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2014/04/09 17:57:06 UTC

git commit: AMBARI-5378. Add Flume service metainfo and scripts (ncole)

Repository: ambari
Updated Branches:
  refs/heads/trunk 89b64a03f -> 386199a71


AMBARI-5378. Add Flume service metainfo and scripts (ncole)


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

Branch: refs/heads/trunk
Commit: 386199a713e8fe65438be26405e952d020e28ac8
Parents: 89b64a0
Author: Nate Cole <nc...@hortonworks.com>
Authored: Mon Apr 7 16:34:09 2014 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Apr 9 11:32:36 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/Role.java     |   3 +-
 .../ganglia/GangliaPropertyProvider.java        |   2 +-
 .../ambari/server/metadata/ActionMetadata.java  |   7 +-
 .../apache/ambari/server/utils/StageUtils.java  |   2 +-
 .../src/main/resources/ganglia_properties.json  |   4 +-
 .../src/main/resources/role_command_order.json  |   4 +-
 .../src/main/resources/scripts/install_flume.sh |  24 ++--
 .../services/FLUME/configuration/global.xml     |  24 ----
 .../HDP/1.3.0/services/FLUME/metainfo.xml       |  30 -----
 .../services/FLUME/configuration/global.xml     |  24 ----
 .../1.3.2.GlusterFS/services/FLUME/metainfo.xml |  30 -----
 .../stacks/HDP/1.3.2/role_command_order.json    |   3 +-
 .../services/FLUME/configuration/global.xml     |  24 ----
 .../HDP/1.3.2/services/FLUME/metainfo.xml       |  31 -----
 .../stacks/HDP/1.3.3/role_command_order.json    |   3 +-
 .../HDP/2.0.6.GlusterFS/role_command_order.json |   4 +-
 .../stacks/HDP/2.0.6/role_command_order.json    |   4 +-
 .../services/FLUME/configuration/flume-conf.xml |  31 +++++
 .../FLUME/configuration/flume-log4j.xml         |  30 +++++
 .../services/FLUME/configuration/global.xml     |  34 +++++
 .../HDP/2.0.6/services/FLUME/metainfo.xml       |  63 +++++++++
 .../services/FLUME/package/scripts/flume.py     | 125 ++++++++++++++++++
 .../FLUME/package/scripts/flume_check.py        |  40 ++++++
 .../FLUME/package/scripts/flume_handler.py      |  56 ++++++++
 .../services/FLUME/package/scripts/params.py    |  46 +++++++
 .../FLUME/package/templates/flume.conf.j2       |  24 ++++
 .../FLUME/package/templates/log4j.properties.j2 |  67 ++++++++++
 .../stacks/HDP/2.0/role_command_order.json      |   4 +-
 .../stacks/HDP/2.1/role_command_order.json      |   4 +-
 .../server/api/services/AmbariMetaInfoTest.java |  16 ---
 .../ganglia/GangliaPropertyProviderTest.java    |  26 ++--
 .../internal/AbstractPropertyProviderTest.java  |   4 +-
 .../ambari/server/metadata/RoleGraphTest.java   |   2 +-
 .../python/stacks/2.0.6/FLUME/test_flume.py     | 129 +++++++++++++++++++
 .../stacks/2.0.6/FLUME/test_service_check.py    |  41 ++++++
 .../python/stacks/2.0.6/configs/default.json    |   6 +
 .../HDP/1.3.4/services/FLUME/metainfo.xml       |  31 -----
 .../stacks/HDP/2.0.6/role_command_order.json    |   4 +-
 .../stacks/HDP/2.0.7/role_command_order.json    |   4 +-
 .../stacks/HDP/2.0.8/role_command_order.json    |   4 +-
 .../stacks/HDP/2.1.1/role_command_order.json    |   4 +-
 41 files changed, 751 insertions(+), 267 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/java/org/apache/ambari/server/Role.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/Role.java b/ambari-server/src/main/java/org/apache/ambari/server/Role.java
index f0024a4..2de7ade 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/Role.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/Role.java
@@ -53,7 +53,8 @@ public class Role {
   
   public static final Role AMBARI_SERVER_ACTION = valueOf("AMBARI_SERVER_ACTION"); 
   public static final Role DATANODE = valueOf("DATANODE");
-  public static final Role FLUME_SERVER = valueOf("FLUME_SERVER");
+  public static final Role FLUME_HANDLER = valueOf("FLUME_HANDLER");
+  public static final Role FLUME_SERVICE_CHECK = valueOf("FLUME_SERVICE_CHECK");
   public static final Role GANGLIA_MONITOR = valueOf("GANGLIA_MONITOR");
   public static final Role GANGLIA_SERVER = valueOf("GANGLIA_SERVER");
   public static final Role HBASE_CLIENT = valueOf("HBASE_CLIENT");

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
index b81c024..8c16bb0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
@@ -67,7 +67,7 @@ public abstract class GangliaPropertyProvider extends AbstractPropertyProvider {
     GANGLIA_CLUSTER_NAME_MAP.put("HISTORYSERVER",      Arrays.asList("HDPHistoryServer"));
     GANGLIA_CLUSTER_NAME_MAP.put("HBASE_MASTER",       Arrays.asList("HDPHBaseMaster"));
     GANGLIA_CLUSTER_NAME_MAP.put("HBASE_REGIONSERVER", Arrays.asList("HDPHBaseRegionServer", "HDPSlaves"));
-    GANGLIA_CLUSTER_NAME_MAP.put("FLUME_SERVER",       Arrays.asList("HDPFlumeServer", "HDPSlaves"));
+    GANGLIA_CLUSTER_NAME_MAP.put("FLUME_HANDLER",      Arrays.asList("HDPFlumeServer", "HDPSlaves"));
     GANGLIA_CLUSTER_NAME_MAP.put("JOURNALNODE",        Arrays.asList("HDPJournalNode", "HDPSlaves"));
     GANGLIA_CLUSTER_NAME_MAP.put("NIMBUS",             Arrays.asList("HDPNimbus"));
     GANGLIA_CLUSTER_NAME_MAP.put("SUPERVISOR",         Arrays.asList("HDPSupervisor"));

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java b/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
index b658712..41e5034 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/metadata/ActionMetadata.java
@@ -78,6 +78,7 @@ public class ActionMetadata {
     serviceActions.put("webhcat"    , Arrays.asList(Role.WEBHCAT_SERVICE_CHECK.toString()));
     serviceActions.put("storm"      , Arrays.asList(Role.STORM_SERVICE_CHECK.toString()));
     serviceActions.put("falcon"     , Arrays.asList(Role.FALCON_SERVICE_CHECK.toString()));
+    serviceActions.put("flume"      , Arrays.asList(Role.FLUME_SERVICE_CHECK.toString()));
   }
 
   private void fillServiceCheckActions() {
@@ -100,9 +101,11 @@ public class ActionMetadata {
     serviceCheckActions.put("webhcat",
         Role.WEBHCAT_SERVICE_CHECK.toString());
     serviceCheckActions.put("storm",
-            Role.STORM_SERVICE_CHECK.toString());
+        Role.STORM_SERVICE_CHECK.toString());
     serviceCheckActions.put("falcon",
-            Role.FALCON_SERVICE_CHECK.toString());
+        Role.FALCON_SERVICE_CHECK.toString());
+    serviceCheckActions.put("flume",
+        Role.FLUME_SERVICE_CHECK.toString());
   }
 
   public List<String> getActions(String serviceName) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
index 3747319..f8b9636 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
@@ -100,7 +100,7 @@ public class StageUtils {
     componentToClusterInfoKeyMap.put("JOURNALNODE", "journalnode_hosts");
     componentToClusterInfoKeyMap.put("ZKFC", "zkfc_hosts");
     componentToClusterInfoKeyMap.put("ZOOKEEPER_SERVER", "zookeeper_hosts");
-    componentToClusterInfoKeyMap.put("FLUME_SERVER", "flume_hosts");
+    componentToClusterInfoKeyMap.put("FLUME_HANDLER", "flume_hosts");
     componentToClusterInfoKeyMap.put("HBASE_MASTER", "hbase_master_hosts");
     componentToClusterInfoKeyMap.put("HBASE_REGIONSERVER", "hbase_rs_hosts");
     componentToClusterInfoKeyMap.put("HIVE_SERVER", "hive_server_host");

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/ganglia_properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/ganglia_properties.json b/ambari-server/src/main/resources/ganglia_properties.json
index 8a488b6..3fe9460 100644
--- a/ambari-server/src/main/resources/ganglia_properties.json
+++ b/ambari-server/src/main/resources/ganglia_properties.json
@@ -10752,7 +10752,7 @@
         "temporal":true
       }
     },
-    "FLUME_SERVER":{
+    "FLUME_HANDLER":{
       "metrics/boottime":{
         "metric":"boottime",
         "pointInTime":true,
@@ -19845,7 +19845,7 @@
         "temporal":true
       }
     },
-    "FLUME_SERVER":{
+    "FLUME_HANDLER":{
       "metrics/boottime":{
         "metric":"boottime",
         "pointInTime":true,

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/role_command_order.json b/ambari-server/src/main/resources/role_command_order.json
index 84610ca..d44e1b4 100644
--- a/ambari-server/src/main/resources/role_command_order.json
+++ b/ambari-server/src/main/resources/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/scripts/install_flume.sh
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/install_flume.sh b/ambari-server/src/main/resources/scripts/install_flume.sh
index a6e59e8..f5ad195 100644
--- a/ambari-server/src/main/resources/scripts/install_flume.sh
+++ b/ambari-server/src/main/resources/scripts/install_flume.sh
@@ -45,36 +45,36 @@ defineService () {
 
 defineServiceComponent () {
   if curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$1/services/FLUME" | grep components | cut -d : -f 2 | grep -q "\[ \]" ; then
-    echo "Defining FLUME_SERVER service component"
-    curl -u $USERID:$PASSWD -X POST "$AMBARIURL/api/v1/clusters/$1/services?ServiceInfo/service_name=FLUME" --data "{\"components\":[{\"ServiceComponentInfo\":{\"component_name\":\"FLUME_SERVER\"}}]}";
+    echo "Defining FLUME_HANDLER service component"
+    curl -u $USERID:$PASSWD -X POST "$AMBARIURL/api/v1/clusters/$1/services?ServiceInfo/service_name=FLUME" --data "{\"components\":[{\"ServiceComponentInfo\":{\"component_name\":\"FLUME_HANDLER\"}}]}";
   else
-    echo "FLUME_SERVER service component already defined."
+    echo "FLUME_HANDLER service component already defined."
   fi
 }
 
 defineHostComponent () {
-  if ! curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$2/hosts/$1" | grep component_name | cut -d : -f 2 | grep -q "FLUME_SERVER" ; then
-    echo "Defining FLUME_SERVER host component on $1"
-    curl -u $USERID:$PASSWD -X POST "$AMBARIURL/api/v1/clusters/$2/hosts?Hosts/host_name=$1" --data "{\"host_components\":[{\"HostRoles\":{\"component_name\":\"FLUME_SERVER\"}}]}";
+  if ! curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$2/hosts/$1" | grep component_name | cut -d : -f 2 | grep -q "FLUME_HANDLER" ; then
+    echo "Defining FLUME_HANDLER host component on $1"
+    curl -u $USERID:$PASSWD -X POST "$AMBARIURL/api/v1/clusters/$2/hosts?Hosts/host_name=$1" --data "{\"host_components\":[{\"HostRoles\":{\"component_name\":\"FLUME_HANDLER\"}}]}";
   else
-    echo "FLUME_SERVER host component already defined on $1."
+    echo "FLUME_HANDLER host component already defined on $1."
   fi
 }
 
 installService () {
   if curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$1/services/FLUME" | grep state | cut -d : -f 2 | grep -q "INIT" ; then
-    echo "Installing FLUME_SERVER service"
+    echo "Installing FLUME_HANDLER service"
     curl -u $USERID:$PASSWD -X PUT "$AMBARIURL/api/v1/clusters/$1/services?ServiceInfo/state=INIT&ServiceInfo/service_name=FLUME" --data "{\"RequestInfo\": {\"context\" :\"Install Flume Service\"}, \"Body\": {\"ServiceInfo\": {\"state\": \"INSTALLED\"}}}";
   else
-    echo "FLUME_SERVER already installed."
+    echo "FLUME_HANDLER already installed."
   fi
 }
 
 startService () {
   if curl -s -u $USERID:$PASSWD "$AMBARIURL/api/v1/clusters/$1/services/FLUME" | grep state | cut -d : -f 2 | grep -q "STARTED" ; then
-    echo "FLUME_SERVER already started."
+    echo "FLUME_HANDLER already started."
   else
-    echo "Starting FLUME_SERVER service"
+    echo "Starting FLUME_HANDLER service"
     curl -u $USERID:$PASSWD -X PUT "$AMBARIURL/api/v1/clusters/$1/services?ServiceInfo/state=INSTALLED&ServiceInfo/service_name=FLUME" --data "{\"RequestInfo\": {\"context\" :\"Start Flume Service\"}, \"Body\": {\"ServiceInfo\": {\"state\": \"STARTED\"}}}";
   fi
 }
@@ -83,6 +83,6 @@ startService () {
 defineService $4
 defineServiceComponent  $4
 defineHostComponent $2 $4
-defineHostComponent $3 $4
+# defineHostComponent $3 $4
 installService $4
 startService $4

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/configuration/global.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/configuration/global.xml
deleted file mode 100644
index f1fa4de..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/configuration/global.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * 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>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/metainfo.xml
deleted file mode 100644
index 87ff4b3..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.0/services/FLUME/metainfo.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-<metainfo>
-    <user>root</user>
-    <comment>Flume is a distributed, reliable, and available system for efficiently collecting, aggregating and moving large amounts of log data from many different sources to a centralized data store.</comment>
-    <version>1.3.1.1.3.0.0</version>
-
-    <components>
-        <component>
-            <name>FLUME_SERVER</name>
-            <category>MASTER</category>
-        </component>
-    </components>
-
-</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/configuration/global.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/configuration/global.xml
deleted file mode 100644
index f1fa4de..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/configuration/global.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * 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>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/metainfo.xml
deleted file mode 100644
index 185f685..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2.GlusterFS/services/FLUME/metainfo.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?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.
--->
-<metainfo>
-    <user>root</user>
-    <comment>Flume is a distributed, reliable, and available system for efficiently collecting, aggregating and moving large amounts of log data from many different sources to a centralized data store.</comment>
-    <version>1.3.1.1.3.2.0</version>
-
-    <components>
-        <component>
-            <name>FLUME_SERVER</name>
-            <category>MASTER</category>
-        </component>
-    </components>
-
-</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.2/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/1.3.2/role_command_order.json
index 84610ca..370f658 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.2/role_command_order.json
@@ -12,13 +12,12 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/configuration/global.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/configuration/global.xml
deleted file mode 100644
index f1fa4de..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/configuration/global.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
-<!--
-/**
- * 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>
-</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/metainfo.xml
deleted file mode 100644
index bebb54e..0000000
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.2/services/FLUME/metainfo.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-<metainfo>
-    <user>root</user>
-    <comment>Flume is a distributed, reliable, and available system for efficiently collecting, aggregating and moving large amounts of log data from many different sources to a centralized data store.</comment>
-    <version>1.3.1.1.3.3.0</version>
-
-    <components>
-        <component>
-            <name>FLUME_SERVER</name>
-            <category>MASTER</category>
-            <cardinality>1</cardinality>
-        </component>
-    </components>
-
-</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/1.3.3/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/1.3.3/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/1.3.3/role_command_order.json
index 84610ca..370f658 100644
--- a/ambari-server/src/main/resources/stacks/HDP/1.3.3/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/1.3.3/role_command_order.json
@@ -12,13 +12,12 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json
index 550f885..9ea4d1e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6.GlusterFS/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
index 4eec50a..4e52917 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-conf.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-conf.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-conf.xml
new file mode 100644
index 0000000..e8ff5fd
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-conf.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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>
+  <property>
+    <name>content</name>
+    <description>Describe all the Flume agent configurations</description>
+    <value>
+# Flume agent config
+    </value>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-log4j.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-log4j.xml
new file mode 100644
index 0000000..e5bd8c6
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/flume-log4j.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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>
+  <property>
+    <name>content</name>
+    <value>
+# Flume log4j config
+    </value>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/global.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/global.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/global.xml
new file mode 100644
index 0000000..7107248
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/configuration/global.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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>
+  <property>
+    <name>flume_conf_dir</name>
+    <value>/etc/flume/conf</value>
+    <description>Location to save configuration files</description>
+  </property>
+  <property>
+    <name>flume_log_dir</name>
+    <value>/var/log/flume</value>
+    <description>Location to save log files</description>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/metainfo.xml
new file mode 100644
index 0000000..f5df089
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/metainfo.xml
@@ -0,0 +1,63 @@
+<?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.
+-->
+<metainfo>
+  <schemaVersion>2.0</schemaVersion>
+  <services>
+    <service>
+      <name>FLUME</name>
+      <comment>Data management and processing platform</comment>
+      <version>1.4.0.2.1.1.0</version>
+      <components>
+        <component>
+          <name>FLUME_HANDLER</name>
+          <category>MASTER</category>
+          <commandScript>
+            <script>scripts/flume_handler.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+
+      <osSpecifics>
+        <osSpecific>
+          <osType>any</osType>
+          <packages>
+            <package>
+              <type>rpm</type>
+              <name>flume</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+
+      <commandScript>
+        <script>scripts/flume_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
+      <configuration-dependencies>
+        <config-type>flume-conf</config-type>
+        <config-type>flume-log4j</config-type>
+        <config-type>global</config-type>
+      </configuration-dependencies>
+
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py
new file mode 100644
index 0000000..cd3676e
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume.py
@@ -0,0 +1,125 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+import os
+from resource_management import *
+
+def flume(action = None):
+  import params
+
+  flume_agents = {}
+  if params.flume_conf_content is not None:
+    flume_agents = buildFlumeTopology(params.flume_conf_content)
+
+  if action == 'config':
+    Directory(params.flume_conf_dir)
+    Directory(params.flume_log_dir, owner=params.flume_user)
+
+    for agent in flume_agents.keys():
+      flume_agent_conf_dir = params.flume_conf_dir + os.sep + agent
+      flume_agent_conf_file = flume_agent_conf_dir + os.sep + 'flume.conf'
+      flume_agent_log4j_file = flume_agent_conf_dir + os.sep + 'log4j.properties'
+
+      Directory(flume_agent_conf_dir)
+
+      PropertiesFile(flume_agent_conf_file,
+        properties=flume_agents[agent],
+        mode = 0644)
+
+      File(flume_agent_log4j_file,
+        content=Template('log4j.properties.j2', agent_name = agent),
+        mode = 0644)
+
+  elif action == 'start':
+    flume_base = format('env JAVA_HOME={java_home} /usr/bin/flume-ng agent '
+      '--name {{0}} '
+      '--conf {{1}} '
+      '--conf-file {{2}} '
+      '{{3}}')
+
+    for agent in flume_agents.keys():
+      flume_agent_conf_dir = params.flume_conf_dir + os.sep + agent
+      flume_agent_conf_file = flume_agent_conf_dir + os.sep + "flume.conf"
+      flume_agent_pid_file = params.flume_run_dir + os.sep + agent + ".pid"
+
+      flume_cmd = flume_base.format(agent, flume_agent_conf_dir,
+         flume_agent_conf_file, "")
+
+      Execute(flume_cmd, wait_for_finish=False)
+
+      # TODO sometimes startup spawns a couple of threads - so only the first line may count
+      pid_cmd = format('pgrep -f {flume_agent_conf_file} > {flume_agent_pid_file}')
+
+      Execute(pid_cmd, logoutput=True, tries=5, try_sleep=10)
+
+    pass
+  elif action == 'stop':
+    import glob
+
+    pid_files = glob.glob(params.flume_run_dir + os.sep + "*.pid")
+
+    if 0 == len(pid_files):
+      return
+
+    for pid_file in pid_files:
+      pid = format('`cat {pid_file}` > /dev/null 2>&1')
+      Execute(format('kill {pid}'), ignore_failures=True)
+
+    for pid_file in pid_files:
+      File(pid_file, action = 'delete')
+    
+    pass
+  elif action == 'status':
+    pass
+
+# define a map of dictionaries, where the key is agent name
+# and the dictionary is the name/value pair
+def buildFlumeTopology(content):
+  import ConfigParser
+  import StringIO
+
+  config = StringIO.StringIO()
+  config.write('[dummy]\n')
+  config.write(content)
+  config.seek(0, os.SEEK_SET)
+
+  cp = ConfigParser.ConfigParser()
+  cp.readfp(config)
+
+  result = {}
+  agent_names = []
+
+  for item in cp.items('dummy'):
+    key = item[0]
+    part0 = key.split('.')[0]
+    if key.endswith(".sources"):
+      agent_names.append(part0)
+
+    if not result.has_key(part0):
+      result[part0] = {}
+
+    result[part0][key] = item[1]
+
+  # trim out non-agents
+  for k in result.keys():
+    if not k in agent_names:
+      del result[k]
+
+  return result
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_check.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_check.py
new file mode 100644
index 0000000..3036e20
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_check.py
@@ -0,0 +1,40 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management import *
+
+
+class FlumeServiceCheck(Script):
+
+  def service_check(self, env):
+    import params
+
+    env.set_params(params)
+    if params.security_enabled:
+      principal_replaced = params.http_principal.replace("_HOST", params.hostname)
+      Execute(format("{kinit_path_local} -kt {http_keytab} {principal_replaced}"),
+              user=params.smoke_user)
+
+    Execute(format('env JAVA_HOME={java_home} /usr/bin/flume-ng version'),
+            logoutput=True,
+            tries = 3,
+            try_sleep = 20)
+
+if __name__ == "__main__":
+  FlumeServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_handler.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_handler.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_handler.py
new file mode 100644
index 0000000..341379d
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/flume_handler.py
@@ -0,0 +1,56 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+"""
+
+from resource_management import *
+from flume import flume
+
+class FlumeHandler(Script):
+  def install(self, env):
+    import params
+
+    self.install_packages(env)
+    env.set_params(params)
+
+  def start(self, env):
+    import params
+
+    env.set_params(params)
+    self.configure(env)
+
+    flume(action='start')
+
+  def stop(self, env):
+    import params
+
+    env.set_params(params)
+
+    flume(action='stop')
+
+  def configure(self, env):
+    import params
+
+    env.set_params(params)
+
+    flume(action='config')
+
+  def status(self, env):
+    pass
+
+if __name__ == "__main__":
+  FlumeHandler().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py
new file mode 100644
index 0000000..6e65d55
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/scripts/params.py
@@ -0,0 +1,46 @@
+"""
+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.
+
+"""
+
+from resource_management import *
+
+config = Script.get_config()
+
+user_group = config['configurations']['global']['user_group']
+proxyuser_group =  config['configurations']['global']['proxyuser_group']
+
+security_enabled = False
+
+java_home = config['hostLevelParams']['java_home']
+
+flume_conf_dir = '/etc/flume/conf'
+flume_log_dir = '/var/log/flume'
+flume_run_dir = '/var/run/flume'
+flume_user = 'flume'
+flume_group = 'flume'
+
+if (('flume-conf' in config['configurations']) and('content' in config['configurations']['flume-conf'])):
+  flume_conf_content = config['configurations']['flume-conf']['content']
+else:
+  flume_conf_content = None
+
+if (('flume-log4j' in config['configurations']) and ('content' in config['configurations']['flume-log4j'])):
+  flume_log4j_content = config['configurations']['flume-log4j']['content']
+else:
+  flume_log4j_content = None
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/flume.conf.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/flume.conf.j2 b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/flume.conf.j2
new file mode 100644
index 0000000..4dee67f
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/flume.conf.j2
@@ -0,0 +1,24 @@
+# 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.
+
+
+# flume.conf: Add your flume configuration here and start flume
+#             Note if you are using the Windows srvice or Unix service
+#             provided by the HDP distribution, they will assume the
+#             agent's name in this file to be 'a1'
+#
+{{flume_agent_conf_content}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/log4j.properties.j2
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/log4j.properties.j2 b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/log4j.properties.j2
new file mode 100644
index 0000000..3b34db8
--- /dev/null
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/FLUME/package/templates/log4j.properties.j2
@@ -0,0 +1,67 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# Define some default values that can be overridden by system properties.
+#
+# For testing, it may also be convenient to specify
+# -Dflume.root.logger=DEBUG,console when launching flume.
+
+#flume.root.logger=DEBUG,console
+flume.root.logger=INFO,LOGFILE
+flume.log.dir={{flume_log_dir}}
+flume.log.file=flume-{{agent_name}}.log
+
+log4j.logger.org.apache.flume.lifecycle = INFO
+log4j.logger.org.jboss = WARN
+log4j.logger.org.mortbay = INFO
+log4j.logger.org.apache.avro.ipc.NettyTransceiver = WARN
+log4j.logger.org.apache.hadoop = INFO
+
+# Define the root logger to the system property "flume.root.logger".
+log4j.rootLogger=${flume.root.logger}
+
+
+# Stock log4j rolling file appender
+# Default log rotation configuration
+log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
+log4j.appender.LOGFILE.MaxFileSize=100MB
+log4j.appender.LOGFILE.MaxBackupIndex=10
+log4j.appender.LOGFILE.File=${flume.log.dir}/${flume.log.file}
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n
+
+
+# Warning: If you enable the following appender it will fill up your disk if you don't have a cleanup job!
+# This uses the updated rolling file appender from log4j-extras that supports a reliable time-based rolling policy.
+# See http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/TimeBasedRollingPolicy.html
+# Add "DAILY" to flume.root.logger above if you want to use this
+log4j.appender.DAILY=org.apache.log4j.rolling.RollingFileAppender
+log4j.appender.DAILY.rollingPolicy=org.apache.log4j.rolling.TimeBasedRollingPolicy
+log4j.appender.DAILY.rollingPolicy.ActiveFileName=${flume.log.dir}/${flume.log.file}
+log4j.appender.DAILY.rollingPolicy.FileNamePattern=${flume.log.dir}/${flume.log.file}.%d{yyyy-MM-dd}
+log4j.appender.DAILY.layout=org.apache.log4j.PatternLayout
+log4j.appender.DAILY.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS} %-5p [%t] (%C.%M:%L) %x - %m%n
+
+
+# console
+# Add "console" to flume.root.logger above if you want to use this
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d (%t) [%p - %l] %m%n

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.0/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.0/role_command_order.json
index 4eec50a..4e52917 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/main/resources/stacks/HDP/2.1/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1/role_command_order.json b/ambari-server/src/main/resources/stacks/HDP/2.1/role_command_order.json
index ded1d23..37de8ce 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1/role_command_order.json
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1/role_command_order.json
@@ -17,13 +17,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
index 553ea95..c76ab46 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
@@ -662,22 +662,6 @@ public class AmbariMetaInfoTest {
   }
 
   @Test
-  public void testFlume134Dependencies() throws Exception {
-    ServiceInfo service = metaInfo.getService(STACK_NAME_HDP, "1.3.4", "FLUME");
-    List<ComponentInfo> componentList = service.getComponents();
-    Assert.assertEquals(1, componentList.size());
-    ComponentInfo component = componentList.get(0);
-    Assert.assertEquals("FLUME_SERVER", component.getName());
-    // dependencies
-    List<DependencyInfo> dependencyList = component.getDependencies();
-    Assert.assertEquals(0, dependencyList.size());
-    // component auto deploy
-    Assert.assertNull(component.getAutoDeploy());
-    // cardinality
-    Assert.assertEquals("1", component.getCardinality());
-  }
-
-  @Test
   public void testGanglia134Dependencies() throws Exception {
     ServiceInfo service = metaInfo.getService(STACK_NAME_HDP, "1.3.4", "GANGLIA");
     List<ComponentInfo> componentList = service.getComponents();

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
index 4e827ab..4dc95a3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProviderTest.java
@@ -418,7 +418,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -431,7 +431,7 @@ public class GangliaPropertyProviderTest {
     
     metricsRegexes.add(FLUME_CHANNEL_CAPACITY_PROPERTY);
 
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
     
@@ -476,7 +476,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -494,7 +494,7 @@ public class GangliaPropertyProviderTest {
     metricsRegexes.add("metrics/flume");
     metricsRegexes.add("metrics/cpu/cpu_wio");
     
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
 
@@ -538,7 +538,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
     Request  request = PropertyHelper.getReadRequest(Collections.<String>emptySet(), temporalInfoMap);
@@ -573,7 +573,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -586,7 +586,7 @@ public class GangliaPropertyProviderTest {
     
     metricsRegexes.add("metrics/flume");
     
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
 
@@ -631,7 +631,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -644,7 +644,7 @@ public class GangliaPropertyProviderTest {
     
     metricsRegexes.add("metrics/flume/");
     
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
 
@@ -689,7 +689,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -703,7 +703,7 @@ public class GangliaPropertyProviderTest {
     metricsRegexes.add("metrics/flume/$1/CHANNEL/$2/");
     metricsRegexes.add(FLUME_CHANNEL_CAPACITY_PROPERTY);
 
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
 
@@ -748,7 +748,7 @@ public class GangliaPropertyProviderTest {
     Resource resource = new ResourceImpl(Resource.Type.HostComponent);
 
     resource.setProperty(HOST_NAME_PROPERTY_ID, "ip-10-39-113-33.ec2.internal");
-    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_SERVER");
+    resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "FLUME_HANDLER");
 
     // only ask for one property
     Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>();
@@ -762,7 +762,7 @@ public class GangliaPropertyProviderTest {
     metricsRegexes.add("metrics/flume/$1/CHANNEL/$2");
     metricsRegexes.add(FLUME_CHANNEL_CAPACITY_PROPERTY);
 
-    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_SERVER");
+    String metricsList = getMetricsRegexes(metricsRegexes, gangliaPropertyIds, "FLUME_HANDLER");
     
     URIBuilder expectedUri = new URIBuilder();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
index ff2d0d2..c5fd49d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractPropertyProviderTest.java
@@ -97,13 +97,13 @@ public class AbstractPropertyProviderTest {
     AbstractPropertyProvider provider = new TestPropertyProvider(componentMetrics);
 
     Map<String, PropertyInfo> flumeMetrics = provider.getComponentMetrics().get(
-      "FLUME_SERVER");
+      "FLUME_HANDLER");
 
     int metricsBefore = flumeMetrics.size();
     String specificMetric = "metrics/flume/arg1/CHANNEL/arg2/ChannelCapacity";
     String specificPropertyInfoId = "arg1.CHANNEL.arg2.ChannelCapacity";
     Map<String, PropertyInfo> componentMetricMap =
-      provider.getComponentMetrics().get("FLUME_SERVER");
+      provider.getComponentMetrics().get("FLUME_HANDLER");
 
     Assert.assertNull(flumeMetrics.get(specificMetric));
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleGraphTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleGraphTest.java b/ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleGraphTest.java
index d8075f2..8d68f9c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleGraphTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/metadata/RoleGraphTest.java
@@ -138,7 +138,7 @@ public class RoleGraphTest {
     RoleGraphNode pig_start = new RoleGraphNode(Role.PIG, RoleCommand.START);
     RoleGraphNode sqoop_start = new RoleGraphNode(Role.SQOOP, RoleCommand.START);
     RoleGraphNode webhcat_srv_start = new RoleGraphNode(Role.WEBHCAT_SERVER, RoleCommand.START);
-    RoleGraphNode flume_start = new RoleGraphNode(Role.FLUME_SERVER, RoleCommand.START);
+    RoleGraphNode flume_start = new RoleGraphNode(Role.FLUME_HANDLER, RoleCommand.START);
     RoleGraphNode zkfc_start = new RoleGraphNode(Role.ZKFC, RoleCommand.START);
     
     Assert.assertEquals(0, rco.order(nn_start, jn_start));

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_flume.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_flume.py b/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_flume.py
new file mode 100644
index 0000000..4c557ad
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_flume.py
@@ -0,0 +1,129 @@
+#!/usr/bin/env python
+
+'''
+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.
+'''
+
+from mock.mock import MagicMock, call, patch
+from stacks.utils.RMFTestCase import *
+import resource_management.core.source
+
+@patch.object(resource_management.core.source, "InlineTemplate", new = MagicMock(return_value='InlineTemplateMock'))
+class TestFlumeHandler(RMFTestCase):
+
+  def test_configure_default(self):
+    self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
+                       classname = "FlumeHandler",
+                       command = "configure",
+                       config_file="default.json"
+    )
+    self.assert_configure_default()
+    self.assertNoMoreResources()
+
+  def test_start_default(self):
+    self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
+                       classname = "FlumeHandler",
+                       command = "start",
+                       config_file="default.json"
+    )
+
+    self.assert_configure_default()
+
+    self.assertResourceCalled('Execute', format('env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/bin/flume-ng agent '
+      '--name a1 '
+      '--conf /etc/flume/conf/a1 '
+      '--conf-file /etc/flume/conf/a1/flume.conf '),
+      wait_for_finish = False)
+
+    self.assertResourceCalled('Execute', 'pgrep -f /etc/flume/conf/a1/flume.conf > /var/run/flume/a1.pid',
+      logoutput = True,
+      tries = 5,
+      try_sleep = 10)
+
+    self.assertNoMoreResources()
+
+  @patch("glob.glob")
+  def test_stop_default(self, glob_mock):
+    glob_mock.return_value = ['/var/run/flume/a1.pid']
+
+    self.executeScript("2.0.6/services/FLUME/package/scripts/flume_handler.py",
+                       classname = "FlumeHandler",
+                       command = "stop",
+                       config_file="default.json"
+    )
+
+    self.assertTrue(glob_mock.called)
+
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/flume/a1.pid` > /dev/null 2>&1',
+      ignore_failures = True)
+
+    self.assertResourceCalled('File', '/var/run/flume/a1.pid', action = ['delete'])
+
+    self.assertNoMoreResources()
+
+  def assert_configure_default(self):
+
+    self.assertResourceCalled('Directory', '/etc/flume/conf')
+
+    self.assertResourceCalled('Directory', '/var/log/flume', owner = 'flume')
+
+    self.assertResourceCalled('Directory', '/etc/flume/conf/a1')
+
+    self.assertResourceCalled('PropertiesFile', '/etc/flume/conf/a1/flume.conf',
+      mode = 0644,
+      properties = buildFlumeTopology(
+        self.getConfig()['configurations']['flume-conf']['content'])['a1'])
+
+    self.assertResourceCalled('File',
+      '/etc/flume/conf/a1/log4j.properties',
+      content = Template('log4j.properties.j2', agent_name = 'a1'),
+      mode = 0644)
+
+
+def buildFlumeTopology(content):
+  import os
+  import ConfigParser
+  import StringIO
+
+  config = StringIO.StringIO()
+  config.write('[dummy]\n')
+  config.write(content)
+  config.seek(0, os.SEEK_SET)
+
+  cp = ConfigParser.ConfigParser()
+  cp.readfp(config)
+
+  result = {}
+  agent_names = []
+
+  for item in cp.items('dummy'):
+    key = item[0]
+    part0 = key.split('.')[0]
+    if key.endswith(".sources"):
+      agent_names.append(part0)
+
+    if not result.has_key(part0):
+      result[part0] = {}
+
+    result[part0][key] = item[1]
+
+  # trim out non-agents
+  for k in result.keys():
+    if not k in agent_names:
+      del result[k]
+
+  return result

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_service_check.py
new file mode 100644
index 0000000..68acd37
--- /dev/null
+++ b/ambari-server/src/test/python/stacks/2.0.6/FLUME/test_service_check.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+'''
+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.
+'''
+
+from stacks.utils.RMFTestCase import *
+
+
+class TestFlumeCheck(RMFTestCase):
+
+  def test_service_check(self):
+    self.executeScript("2.0.6/services/FLUME/package/scripts/flume_check.py",
+                       classname="FlumeServiceCheck",
+                       command="service_check",
+                       config_file="default.json"
+    )
+
+    self.assertResourceCalled('Execute', 'env JAVA_HOME=/usr/jdk64/jdk1.7.0_45 /usr/bin/flume-ng version',
+                              logoutput = True,
+                              tries = 3,
+                              try_sleep = 20)
+
+    self.assertNoMoreResources()
+
+  # TODO secured service check
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
index 61dca49..c621a6d 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.0.6/configs/default.json
@@ -513,6 +513,12 @@
         },
         "oozie-log4j": {
             "content": "log4jproperties\nline2"
+        },
+        "flume-conf": {
+          "content": "a1.sources = r1\n a1.sinks = k1\n a1.channels = c1\n # Describe/configure the source\n a1.sources.r1.type = netcat\n a1.sources.r1.bind = localhost\n a1.sources.r1.port = 44444\n \n # Describe the sink\n a1.sinks.k1.type = logger\n \n # Use a channel which buffers events in memory\n a1.channels.c1.type = memory\n a1.channels.c1.capacity = 1000\n a1.channels.c1.transactionCapacity = 100\n \n # Bind the source and sink to the channel\n a1.sources.r1.channels = c1\n a1.sinks.k1.channel = c1\n"
+        },
+        "flume-log4j": {
+          "content": "log4jproperties\nline2"
         }
     },
     "configurationTags": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/resources/stacks/HDP/1.3.4/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/1.3.4/services/FLUME/metainfo.xml b/ambari-server/src/test/resources/stacks/HDP/1.3.4/services/FLUME/metainfo.xml
deleted file mode 100644
index bebb54e..0000000
--- a/ambari-server/src/test/resources/stacks/HDP/1.3.4/services/FLUME/metainfo.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?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.
--->
-<metainfo>
-    <user>root</user>
-    <comment>Flume is a distributed, reliable, and available system for efficiently collecting, aggregating and moving large amounts of log data from many different sources to a centralized data store.</comment>
-    <version>1.3.1.1.3.3.0</version>
-
-    <components>
-        <component>
-            <name>FLUME_SERVER</name>
-            <category>MASTER</category>
-            <cardinality>1</cardinality>
-        </component>
-    </components>
-
-</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/resources/stacks/HDP/2.0.6/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.6/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/2.0.6/role_command_order.json
index 550f885..9ea4d1e 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.6/role_command_order.json
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.6/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START", "MAPREDUCE2_SERVICE_CHECK-SERVICE_CHECK"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/resources/stacks/HDP/2.0.7/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.7/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/2.0.7/role_command_order.json
index 84610ca..d44e1b4 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.7/role_command_order.json
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.7/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/resources/stacks/HDP/2.0.8/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.0.8/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/2.0.8/role_command_order.json
index 84610ca..d44e1b4 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.0.8/role_command_order.json
+++ b/ambari-server/src/test/resources/stacks/HDP/2.0.8/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],

http://git-wip-us.apache.org/repos/asf/ambari/blob/386199a7/ambari-server/src/test/resources/stacks/HDP/2.1.1/role_command_order.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/resources/stacks/HDP/2.1.1/role_command_order.json b/ambari-server/src/test/resources/stacks/HDP/2.1.1/role_command_order.json
index 84610ca..d44e1b4 100644
--- a/ambari-server/src/test/resources/stacks/HDP/2.1.1/role_command_order.json
+++ b/ambari-server/src/test/resources/stacks/HDP/2.1.1/role_command_order.json
@@ -12,13 +12,13 @@
     "HIVE_METASTORE-START": ["MYSQL_SERVER-START"],
     "HIVE_SERVER-START": ["TASKTRACKER-START", "MYSQL_SERVER-START"],
     "HUE_SERVER-START": ["HIVE_SERVER-START", "HCAT-START", "OOZIE_SERVER-START"],
-    "FLUME_SERVER-START": ["OOZIE_SERVER-START"],
+    "FLUME_HANDLER-START": ["OOZIE_SERVER-START"],
     "NAGIOS_SERVER-START": ["HBASE_MASTER-START", "HBASE_REGIONSERVER-START",
         "GANGLIA_SERVER-START", "GANGLIA_MONITOR-START", "HCAT-START",
         "HIVE_SERVER-START", "HIVE_METASTORE-START", "HUE_SERVER-START",
         "JOBTRACKER-START", "TASKTRACKER-START", "ZOOKEEPER_SERVER-START",
         "MYSQL_SERVER-START", "OOZIE_SERVER-START", "PIG-START", "SQOOP-START",
-        "WEBHCAT_SERVER-START", "FLUME_SERVER-START"],
+        "WEBHCAT_SERVER-START", "FLUME_HANDLER-START"],
     "MAPREDUCE_SERVICE_CHECK-SERVICE_CHECK": ["JOBTRACKER-START", "TASKTRACKER-START"],
     "OOZIE_SERVICE_CHECK-SERVICE_CHECK": ["OOZIE_SERVER-START"],
     "WEBHCAT_SERVICE_CHECK-SERVICE_CHECK": ["WEBHCAT_SERVER-START"],