http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/metric_monitor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/metric_monitor.py
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/metric_monitor.py
new file mode 100644
index 0000000..23bdf39
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/metric_monitor.py
@@ -0,0 +1,61 @@
+#!/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 resource_management import *
+from ams import ams
+from ams_service import ams_service
+from hbase import hbase
+
+class AmsMonitor(Script):
+  def install(self, env):
+    self.install_packages(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    ams(name='monitor')
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env) # for security
+
+    ams_service( 'monitor',
+                 action = 'start'
+    )
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+
+    ams_service( 'monitor',
+                 action = 'stop'
+    )
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    pid_file = format("{ams_monitor_pid_dir}/ambari-metrics-monitor.pid")
+    check_process_status(pid_file)
+
+
+if __name__ == "__main__":
+  AmsMonitor().execute()
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/params.py
new file mode 100644
index 0000000..278bb90
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/params.py
@@ -0,0 +1,174 @@
+#!/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 functions import calc_xmn_from_xms
+from resource_management import *
+import status_params
+
+# server configurations
+config = Script.get_config()
+exec_tmp_dir = Script.get_tmp_dir()
+
+#AMS data
+ams_user=status_params.ams_user
+ams_pid_dir="/var/run/ambari-metrics"
+
+ams_collector_script = "/usr/sbin/ambari-metrics-collector"
+ams_collector_conf_dir = "/etc/ambari-metrics-collector/conf"
+ams_collector_pid_dir = status_params.ams_collector_pid_dir
+ams_collector_hosts = default("/clusterHostInfo/metric_collector_hosts", [])
+ams_collector_host_single = ams_collector_hosts[0] #TODO cardinality is 1+ so 
we can have more than one host
+ams_collector_port = 8188
+
+
+ams_monitor_conf_dir = "/etc/ambari-metrics-monitor/conf/"
+ams_monitor_dir = "/usr/lib/python2.6/site-packages/resource_monitoring"
+ams_monitor_pid_dir = status_params.ams_monitor_pid_dir
+ams_monitor_script = "/usr/sbin/ambari-metrics-monitor"
+
+#RPM versioning support
+rpm_version = default("/configurations/hadoop-env/rpm_version", None)
+
+#hadoop params
+if rpm_version is not None:
+#RPM versioning support
+  rpm_version = default("/configurations/hadoop-env/rpm_version", None)
+
+#hadoop params
+if rpm_version is not None:
+  hadoop_native_lib = format("/usr/hdp/current/hadoop-client/lib/native/")
+  hadoop_bin_dir = format("/usr/hdp/current/hadoop/bin")
+  daemon_script = format('/usr/hdp/current/hbase/bin/hbase-daemon.sh')
+  region_mover = format('/usr/hdp/current/hbase/bin/region_mover.rb')
+  region_drainer = format('/usr/hdp/current/hbase/bin/draining_servers.rb')
+  hbase_cmd = format('/usr/hdp/current/hbase/bin/hbase')
+else:
+  hadoop_native_lib = format("/usr/lib/hadoop/lib/native")
+  hadoop_bin_dir = "/usr/bin"
+  daemon_script = "/usr/lib/hbase/bin/hbase-daemon.sh"
+  region_mover = "/usr/lib/hbase/bin/region_mover.rb"
+  region_drainer = "/usr/lib/hbase/bin/draining_servers.rb"
+  hbase_cmd = "/usr/lib/hbase/bin/hbase"
+
+hadoop_conf_dir = "/etc/hadoop/conf"
+#hbase_conf_dir = "/etc/ams-hbase/conf"
+hbase_conf_dir = "/etc/ams-hbase/conf"
+hbase_excluded_hosts = config['commandParams']['excluded_hosts']
+hbase_drain_only = config['commandParams']['mark_draining_only']
+hbase_included_hosts = config['commandParams']['included_hosts']
+
+hbase_user = status_params.hbase_user
+smokeuser = config['configurations']['cluster-env']['smokeuser']
+_authentication = 
config['configurations']['core-site']['hadoop.security.authentication']
+security_enabled = config['configurations']['cluster-env']['security_enabled']
+
+# this is "hadoop-metrics.properties" for 1.x stacks
+metric_prop_file_name = "hadoop-metrics2-hbase.properties"
+
+# not supporting 32 bit jdk.
+java64_home = config['hostLevelParams']['java_home']
+
+hbase_log_dir = config['configurations']['ams-hbase-env']['hbase_log_dir']
+master_heapsize = 
config['configurations']['ams-hbase-env']['hbase_master_heapsize']
+
+regionserver_heapsize = 
config['configurations']['ams-hbase-env']['hbase_regionserver_heapsize']
+regionserver_xmn_max = 
config['configurations']['ams-hbase-env']['hbase_regionserver_xmn_max']
+regionserver_xmn_percent = 
config['configurations']['ams-hbase-env']['hbase_regionserver_xmn_ratio']
+regionserver_xmn_size = calc_xmn_from_xms(regionserver_heapsize, 
regionserver_xmn_percent, regionserver_xmn_max)
+
+hbase_pid_dir = status_params.hbase_pid_dir
+hbase_tmp_dir = config['configurations']['ams-hbase-site']['hbase.tmp.dir']
+# TODO UPGRADE default, update site during upgrade
+_local_dir_conf = default('/configurations/ams-hbase-site/hbase.local.dir', 
"${hbase.tmp.dir}/local")
+local_dir = substitute_vars(_local_dir_conf, 
config['configurations']['ams-hbase-site'])
+
+client_jaas_config_file = format("{hbase_conf_dir}/hbase_client_jaas.conf")
+master_jaas_config_file = format("{hbase_conf_dir}/hbase_master_jaas.conf")
+regionserver_jaas_config_file = 
format("{hbase_conf_dir}/hbase_regionserver_jaas.conf")
+
+# ganglia_server_hosts = default('/clusterHostInfo/ganglia_server_host', []) # 
is not passed when ganglia is not present
+# ganglia_server_host = '' if len(ganglia_server_hosts) == 0 else 
ganglia_server_hosts[0]
+
+# if hbase is selected the hbase_rs_hosts, should not be empty, but still 
default just in case
+# if 'slave_hosts' in config['clusterHostInfo']:
+#   rs_hosts = default('/clusterHostInfo/hbase_rs_hosts', 
'/clusterHostInfo/slave_hosts') #if hbase_rs_hosts not given it is assumed that 
region servers on same nodes as slaves
+# else:
+#   rs_hosts = default('/clusterHostInfo/hbase_rs_hosts', 
'/clusterHostInfo/all_hosts')
+
+rs_hosts = ["localhost"]
+
+smoke_test_user = config['configurations']['cluster-env']['smokeuser']
+smokeuser_permissions = "RWXCA"
+service_check_data = functions.get_unique_id_and_date()
+user_group = config['configurations']['cluster-env']["user_group"]
+
+if security_enabled:
+  _hostname_lowercase = config['hostname'].lower()
+  master_jaas_princ = 
config['configurations']['ams-hbase-site']['hbase.master.kerberos.principal'].replace('_HOST',_hostname_lowercase)
+  regionserver_jaas_princ = 
config['configurations']['ams-hbase-site']['hbase.regionserver.kerberos.principal'].replace('_HOST',_hostname_lowercase)
+
+master_keytab_path = 
config['configurations']['ams-hbase-site']['hbase.master.keytab.file']
+regionserver_keytab_path = 
config['configurations']['ams-hbase-site']['hbase.regionserver.keytab.file']
+smoke_user_keytab = config['configurations']['cluster-env']['smokeuser_keytab']
+hbase_user_keytab = 
config['configurations']['ams-hbase-env']['hbase_user_keytab']
+kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", 
"/usr/sbin"])
+
+# if security_enabled:
+#   kinit_cmd = format("{kinit_path_local} -kt {hbase_user_keytab} 
{hbase_user};")
+# else:
+#   kinit_cmd = ""
+
+#log4j.properties
+if (('ams-hbase-log4j' in config['configurations']) and ('content' in 
config['configurations']['ams-hbase-log4j'])):
+  hbase_log4j_props = config['configurations']['ams-hbase-log4j']['content']
+else:
+  hbase_log4j_props = None
+
+if (('ams-log4j' in config['configurations']) and ('content' in 
config['configurations']['ams-log4j'])):
+  log4j_props = config['configurations']['ams-log4j']['content']
+else:
+  log4j_props = None
+
+hbase_env_sh_template = config['configurations']['ams-hbase-env']['content']
+ams_env_sh_template = config['configurations']['ams-env']['content']
+
+hbase_hdfs_root_dir = 
config['configurations']['ams-hbase-site']['hbase.rootdir']
+hbase_staging_dir = "/apps/hbase/staging"
+#for create_hdfs_directory
+hostname = config["hostname"]
+hdfs_user_keytab = config['configurations']['hadoop-env']['hdfs_user_keytab']
+hdfs_user = config['configurations']['hadoop-env']['hdfs_user']
+hdfs_principal_name = 
config['configurations']['hadoop-env']['hdfs_principal_name']
+kinit_path_local = functions.get_kinit_path(["/usr/bin", "/usr/kerberos/bin", 
"/usr/sbin"])
+import functools
+#create partial functions with common arguments for every HdfsDirectory call
+#to create hdfs directory we need to call params.HdfsDirectory in code
+# HdfsDirectory = functools.partial(
+#   HdfsDirectory,
+#   conf_dir=hadoop_conf_dir,
+#   hdfs_user=hdfs_user,
+#   security_enabled = security_enabled,
+#   keytab = hdfs_user_keytab,
+#   kinit_path_local = kinit_path_local,
+#   bin_dir = hadoop_bin_dir
+# )
+
+
+

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/service_check.py
new file mode 100644
index 0000000..5561e10
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/service_check.py
@@ -0,0 +1,19 @@
+#!/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.
+
+"""

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/status_params.py
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/status_params.py
new file mode 100644
index 0000000..0e949eb
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/scripts/status_params.py
@@ -0,0 +1,30 @@
+#!/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 resource_management import *
+
+config = Script.get_config()
+
+hbase_pid_dir = config['configurations']['ams-hbase-env']['hbase_pid_dir']
+hbase_user = config['configurations']['ams-hbase-env']['hbase_user']
+ams_user = config['configurations']['ams-env']['ams_user']
+
+ams_monitor_pid_dir = "/var/run/ambari-metrics-monitor"
+ams_collector_pid_dir = "/var/run/ambari-metrics-collector"

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hadoop-metrics2-hbase.properties.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hadoop-metrics2-hbase.properties.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hadoop-metrics2-hbase.properties.j2
new file mode 100644
index 0000000..3e980f7
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hadoop-metrics2-hbase.properties.j2
@@ -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.
+#}
+
+# 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.
+
+# syntax: [prefix].[source|sink|jmx].[instance].[options]
+# See package.html for org.apache.hadoop.metrics2 for details
+
+# HBase-specific configuration to reset long-running stats (e.g. compactions)
+# If this variable is left out, then the default is no expiration.
+hbase.extendedperiod = 3600
+
+hbase.class=org.apache.hadoop.metrics2.sink.timeline.HadoopTimelineMetricsSink
+hbase.period=10
+hbase.collector={{ams_collector_host_single}}:8188
+
+jvm.class=org.apache.hadoop.metrics2.sink.timeline.HadoopTimelineMetricsSink
+jvm.period=10
+jvm.collector={{ams_collector_host_single}}:8188
+
+rpc.class=org.apache.hadoop.metrics2.sink.timeline.HadoopTimelineMetricsSink
+rpc.period=10
+rpc.collector={{ams_collector_host_single}}:8188
+
+hbase.sink.timeline.class=org.apache.hadoop.metrics2.sink.timeline.HadoopTimelineMetricsSink
+hbase.sink.timeline.period=10
+hbase.sink.timeline.collector={{ams_collector_host_single}}:8188
+hbase.sink.timeline.serviceName-prefix=ams

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_client_jaas.conf.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_client_jaas.conf.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_client_jaas.conf.j2
new file mode 100644
index 0000000..38f9721
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_client_jaas.conf.j2
@@ -0,0 +1,23 @@
+{#
+# 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.
+#}
+
+Client {
+com.sun.security.auth.module.Krb5LoginModule required
+useKeyTab=false
+useTicketCache=true;
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_grant_permissions.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_grant_permissions.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_grant_permissions.j2
new file mode 100644
index 0000000..3378983
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_grant_permissions.j2
@@ -0,0 +1,39 @@
+{#
+# 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.
+#}
+
+#
+# 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.
+#
+#
+grant '{{smoke_test_user}}', '{{smokeuser_permissions}}'
+exit
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_master_jaas.conf.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_master_jaas.conf.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_master_jaas.conf.j2
new file mode 100644
index 0000000..a93c36c
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_master_jaas.conf.j2
@@ -0,0 +1,26 @@
+{#
+# 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.
+#}
+
+Client {
+com.sun.security.auth.module.Krb5LoginModule required
+useKeyTab=true
+storeKey=true
+useTicketCache=false
+keyTab="{{master_keytab_path}}"
+principal="{{master_jaas_princ}}";
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_regionserver_jaas.conf.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_regionserver_jaas.conf.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_regionserver_jaas.conf.j2
new file mode 100644
index 0000000..7097481
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/hbase_regionserver_jaas.conf.j2
@@ -0,0 +1,26 @@
+{#
+# 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.
+#}
+
+Client {
+com.sun.security.auth.module.Krb5LoginModule required
+useKeyTab=true
+storeKey=true
+useTicketCache=false
+keyTab="{{regionserver_keytab_path}}"
+principal="{{regionserver_jaas_princ}}";
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_groups.conf.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_groups.conf.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_groups.conf.j2
new file mode 100644
index 0000000..aa03d19
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_groups.conf.j2
@@ -0,0 +1,37 @@
+{#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+
+{
+   "host_metric_groups": {
+      "all": {
+         "collect_every": "10",
+         "metrics": [
+            {
+               "name": "bytes_out",
+               "value_threshold": "128"
+            }
+         ]
+      }
+   },
+   "process_metric_groups": {
+      "": {
+         "collect_every": "15",
+         "metrics": []
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2
new file mode 100644
index 0000000..5e672fc
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/metric_monitor.ini.j2
@@ -0,0 +1,30 @@
+{#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#}
+
+[default]
+debug_level = INFO
+metrics_server = {{ams_collector_host_single}}:{{ams_collector_port}}
+enable_time_threshold = false
+enable_value_threshold = false
+
+[emitter]
+send_interval = 60
+
+[collector]
+collector_sleep_interval = 5
+max_queue_size = 5000

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/regionservers.j2
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/regionservers.j2
 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/regionservers.j2
new file mode 100644
index 0000000..fc6cc37
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/AMS/0.1.0/package/templates/regionservers.j2
@@ -0,0 +1,20 @@
+{#
+# 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.
+#}
+
+{% for host in rs_hosts %}{{host}}
+{% endfor %}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/alerts.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/alerts.json 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/alerts.json
new file mode 100644
index 0000000..4c9884c
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/alerts.json
@@ -0,0 +1,32 @@
+{
+  "KAFKA": {
+    "service": [],
+    "KAFKA_BROKER": [
+      {
+        "name": "kafka_broker_process",
+        "label": "Kafka Broker Process",
+        "description": "This host-level alert is triggered if the Kafka Broker 
cannot be determined to be up.",
+        "interval": 1,
+        "scope": "HOST",
+        "source": {
+          "type": "PORT",
+          "uri": "{{kafka-broker/port}}",
+          "default_port": 6667,
+          "reporting": {
+            "ok": {
+              "text": "TCP OK - {0:.3f}s response on port {1}"
+            },
+            "warning": {
+              "text": "TCP OK - {0:.3f}s response on port {1}",
+              "value": 1.5
+            },
+            "critical": {
+              "text": "Connection failed: {0} to {1}:{2}",
+              "value": 5.0
+            }
+          }
+        }
+      }
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
new file mode 100644
index 0000000..dc1b6b4
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-broker.xml
@@ -0,0 +1,321 @@
+<?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>log.dirs</name>
+    <value>/kafka-logs</value>
+    <description>
+      A comma-separated list of one or more directories in which Kafka data is 
stored.
+      Each new partition that is created will be placed in the directory which 
currently has the fewest partitions.
+    </description>
+  </property>
+  <property>
+    <name>port</name>
+    <value>6667</value>
+    <description>
+      The port on which the server accepts client connections.
+    </description>
+  </property>
+  <property>
+    <name>zookeeper.connect</name>
+    <value>localhost:2181</value>
+    <description>
+      Zookeeper also allows you to add a "chroot" path which will make all 
kafka data for this cluster appear under a particular path.
+      This is a way to setup multiple Kafka clusters or other applications on 
the same zookeeper cluster. To do this give a connection
+      string in the form 
hostname1:port1,hostname2:port2,hostname3:port3/chroot/path which would put all 
this cluster's data under the
+      path /chroot/path. Note that you must create this path yourself prior to 
starting the broker and consumers must use the
+      same connection string.
+    </description>
+  </property>
+  <property>
+    <name>message.max.bytes</name>
+    <value>1000000</value>
+    <description>
+      The maximum size of a message that the server can receive.
+      It is important that this property be in sync with the maximum fetch 
size your consumers use or
+      else an unruly producer will be able to publish messages too large for 
consumers to consume.
+    </description>
+  </property>
+  <property>
+    <name>num.network.threads</name>
+    <value>3</value>
+    <description>
+      The number of network threads that the server uses for handling network 
requests.
+      You probably don't need to change this.
+    </description>
+  </property>
+  <property>
+    <name>num.io.threads</name>
+    <value>8</value>
+    <description>
+      The number of I/O threads that the server uses for executing requests. 
You should have at least as many threads as you have disks.
+    </description>
+  </property>
+  <property>
+    <name>queued.max.requests</name>
+    <value>500</value>
+    <description>The number of requests that can be queued up for processing 
by the I/O threads before the network threads stop reading in new 
requests.</description>
+  </property>
+  <property>
+    <name>socket.send.buffer.bytes</name>
+    <value>102400</value>
+    <description>
+      The SO_SNDBUFF buffer the server prefers for socket connections.
+    </description>
+  </property>
+  <property>
+    <name>socket.receive.buffer.bytes</name>
+    <value>102400</value>
+    <description>
+      The SO_RCVBUFF buffer the server prefers for socket connections.
+    </description>
+  </property>
+  <property>
+    <name>socket.request.max.bytes</name>
+    <value>104857600</value>
+    <description>
+      The maximum request size the server will allow. This prevents the server 
from running out of memory and should be smaller than the Java heap size.
+    </description>
+  </property>
+  <property>
+    <name>num.partitions</name>
+    <value>1</value>
+    <description>
+               The default number of partitions per topic.
+    </description>
+  </property>
+  <property>
+    <name>log.segment.bytes</name>
+    <value>1073741824</value>
+    <description>
+      The maximum request size the server will allow.
+      This prevents the server from running out of memory and should be 
smaller than the Java heap size.
+    </description>
+  </property>
+  <property>
+    <name>log.roll.hours</name>
+    <value>168</value>
+    <description>
+      This setting will force Kafka to roll a new log segment even if the 
log.segment.bytes size has not been reached.
+    </description>
+  </property>
+  <property>
+    <name>log.retention.bytes</name>
+    <value>-1</value>
+    <description>
+      The amount of data to retain in the log for each topic-partitions. Note 
that this is the limit per-partition so multiply by the number of partitions to 
get the total data retained for the topic. Also note that if both 
log.retention.hours and log.retention.bytes are both set we delete a segment 
when either limit is exceeded.
+    </description>
+  </property>
+  <property>
+    <name>log.retention.hours</name>
+    <value>168</value>
+    <description>
+      The number of hours to keep a log segment before it is deleted, i.e. the 
default data retention window for all topics. Note that if both 
log.retention.hours and log.retention.bytes are both set we delete a segment 
when either limit is exceeded.
+    </description>
+  </property>
+  <property>
+    <name>log.cleanup.interval.mins</name>
+    <value>10</value>
+    <description>The frequency in minutes that the log cleaner checks whether 
any log segment is eligible for deletion to meet the retention policies.
+    </description>
+  </property>
+  <property>
+    <name>log.index.size.max.bytes</name>
+    <value>10485760</value>
+    <description>
+      The maximum size in bytes we allow for the offset index for each log 
segment. Note that we will always pre-allocate a
+      sparse file with this much space and shrink it down when the log rolls. 
If the index fills up we will roll a new log segment
+      even if we haven't reached the log.segment.bytes limit.
+    </description>
+  </property>
+  <property>
+    <name>log.index.interval.bytes</name>
+    <value>4096</value>
+    <description>
+      The byte interval at which we add an entry to the offset index. When 
executing a fetch request the server must do a linear scan for up to this many 
bytes to find the correct position in the log to begin and end the fetch. So 
setting this value to be larger will mean larger index files (and a bit more 
memory usage) but less scanning. However the server will never add more than 
one index entry per log append (even if more than log.index.interval worth of 
messages are appended). In general you probably don't need to mess with this 
value.
+    </description>
+  </property>
+  <property>
+    <name>log.flush.interval.messages</name>
+    <value>10000</value>
+    <description>The number of messages written to a log partition before we 
force an fsync on the log. Setting this higher will improve performance a lot 
but will increase the window of data at risk in the event of a crash (though 
that is usually best addressed through replication). If both this setting and 
log.flush.interval.ms are both used the log will be flushed when either 
criteria is met.
+    </description>
+  </property>
+  <property>
+    <name>log.flush.scheduler.interval.ms</name>
+    <value>3000</value>
+    <description>
+      The frequency in ms that the log flusher checks whether any log is 
eligible to be flushed to disk.
+    </description>
+  </property>
+  <property>
+    <name>log.flush.interval.ms</name>
+    <value>3000</value>
+    <description>
+      The maximum time between fsync calls on the log. If used in conjuction 
with log.flush.interval.messages the log will be flushed when either criteria 
is met.
+    </description>
+  </property>
+  <property>
+    <name>auto.create.topics.enable</name>
+    <value>true</value>
+    <description>
+      Enable auto creation of topic on the server. If this is set to true then 
attempts to produce, consume, or fetch metadata for a non-existent topic will 
automatically create it with the default replication factor and number of 
partitions.
+    </description>
+  </property>
+  <property>
+    <name>controller.socket.timeout.ms</name>
+    <value>30000</value>
+    <property>The socket timeout for commands from the partition management 
controller to the replicas.</property>
+  </property>
+  <property>
+    <name>controller.message.queue.size</name>
+    <value>10</value>
+    <description>The buffer size for 
controller-to-broker-channels</description>
+  </property>
+  <property>
+    <name>default.replication.factor</name>
+    <value>1</value>
+    <description>The default replication factor for automatically created 
topics.</description>
+  </property>
+  <property>
+    <name>replica.lag.time.max.ms</name>
+    <value>10000</value>
+    <description>If a follower hasn't sent any fetch requests for this window 
of time, the leader will remove the follower from ISR (in-sync replicas) and 
treat it as dead.</description>
+  </property>
+  <property>
+    <name>replica.lag.max.messages</name>
+    <value>4000</value>
+    <description>
+      If a replica falls more than this many messages behind the leader, the 
leader will remove the follower from ISR and treat it as dead.
+    </description>
+  </property>
+  <property>
+    <name>replica.socket.timeout.ms</name>
+    <value>30000</value>
+    <description>The socket timeout for network requests to the leader for 
replicating data.</description>
+  </property>
+  <property>
+    <name>replica.socket.receive.buffer.bytes</name>
+    <value>65536</value>
+    <description>The socket receive buffer for network requests to the leader 
for replicating data.</description>
+  </property>
+  <property>
+    <name>replica.fetch.max.bytes</name>
+    <value>1048576</value>
+    <description>The number of byes of messages to attempt to fetch for each 
partition in the fetch requests the replicas send to the leader.</description>
+  </property>
+  <property>
+    <name>replica.fetch.wait.max.ms</name>
+    <value>500</value>
+    <description>The maximum amount of time to wait time for data to arrive on 
the leader in the fetch requests sent by the replicas to the 
leader.</description>
+  </property>
+  <property>
+    <name>replica.fetch.min.bytes</name>
+    <value>1</value>
+    <description>Minimum bytes expected for each fetch response for the fetch 
requests from the replica to the leader. If not enough bytes, wait up to 
replica.fetch.wait.max.ms for this many bytes to arrive.
+    </description>
+  </property>
+  <property>
+    <name>num.replica.fetchers</name>
+    <value>1</value>
+    <description>
+      Number of threads used to replicate messages from leaders. Increasing 
this value can increase the degree of I/O parallelism in the follower broker.
+    </description>
+  </property>
+  <property>
+    <name>replica.high.watermark.checkpoint.interval.ms</name>
+    <value>5000</value>
+    <description>The frequency with which each replica saves its high 
watermark to disk to handle recovery.</description>
+  </property>
+  <property>
+    <name>fetch.purgatory.purge.interval.requests</name>
+    <value>10000</value>
+    <description>The purge interval (in number of requests) of the fetch 
request purgatory.</description>
+  </property>
+  <property>
+    <name>producer.purgatory.purge.interval.requests</name>
+    <value>10000</value>
+    <description>The purge interval (in number of requests) of the producer 
request purgatory.</description>
+  </property>
+  <property>
+    <name>zookeeper.session.timeout.ms</name>
+    <value>6000</value>
+    <description>Zookeeper session timeout. If the server fails to heartbeat 
to zookeeper within this period of time it is considered dead. If you set this 
too low the server may be falsely considered dead; if you set it too high it 
may take too long to recognize a truly dead server.</description>
+  </property>
+  <property>
+    <name>zookeeper.connection.timeout.ms</name>
+    <value>6000</value>
+    <description>The maximum amount of time that the client waits to establish 
a connection to zookeeper.</description>
+  </property>
+  <property>
+    <name>zookeeper.sync.time.ms</name>
+    <value>2000</value>
+    <description>How far a ZK follower can be behind a ZK leader.</description>
+  </property>
+  <property>
+    <name>controlled.shutdown.enable</name>
+    <value>false</value>
+    <description>Enable controlled shutdown of the broker. If enabled, the 
broker will move all leaders on it to some other brokers before shutting itself 
down. This reduces the unavailability window during shutdown.</description>
+  </property>
+  <property>
+    <name>controlled.shutdown.max.retries</name>
+    <value>3</value>
+    <description>Number of retries to complete the controlled shutdown 
successfully before executing an unclean shutdown.</description>
+  </property>
+  <property>
+    <name>controlled.shutdown.retry.backoff.ms</name>
+    <value>5000</value>
+    <description>
+      Backoff time between shutdown retries.
+    </description>
+  </property>
+  <property>
+    <name>kafka.metrics.reporters</name>
+    <value>kafka.ganglia.KafkaGangliaMetricsReporter</value>
+    <description>
+      kafka ganglia metrics reporter
+    </description>
+  </property>
+  <property>
+    <name>kafka.ganglia.metrics.reporter.enabled</name>
+    <value>true</value>
+    <description>
+      kafka ganglia metrics reporter enable
+    </description>
+  </property>
+  <property>
+    <name>kafka.ganglia.metrics.host</name>
+    <value>localhost</value>
+    <description> Ganglia host </description>
+  </property>
+  <property>
+    <name>kafka.ganglia.metrics.port</name>
+    <value>8671</value>
+    <description> Ganglia port </description>
+  </property>
+  <property>
+    <name>kafka.ganglia.metrics.group</name>
+    <value>kafka</value>
+    <description>Ganglia group name </description>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
new file mode 100644
index 0000000..7ad4396
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-env.xml
@@ -0,0 +1,55 @@
+<?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>kafka_user</name>
+    <value>kafka</value>
+    <property-type>USER</property-type>
+    <description></description>
+  </property>
+  <property>
+    <name>kafka_log_dir</name>
+    <value>/var/log/kafka</value>
+    <description></description>
+  </property>
+  <property>
+    <name>kafka_pid_dir</name>
+    <value>/var/run/kafka</value>
+    <description></description>
+  </property>
+
+  <!-- kafka-env.sh -->
+  <property>
+    <name>content</name>
+    <description>This is the jinja template for kafka-env.sh file</description>
+    <value>
+#!/bin/bash
+
+# Set KAFKA specific environment variables here.
+
+# The java implementation to use.
+export JAVA_HOME={{java64_home}}
+export PATH=$PATH:$JAVA_HOME/bin
+    </value>
+  </property>
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-log4j.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-log4j.xml
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-log4j.xml
new file mode 100644
index 0000000..901859e
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/configuration/kafka-log4j.xml
@@ -0,0 +1,116 @@
+<?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 supports_final="false">
+
+  <property>
+    <name>content</name>
+    <description>Custom log4j.properties</description>
+    <value>
+#
+#
+# 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.
+#
+#
+#
+kafka.logs.dir=logs
+
+log4j.rootLogger=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+log4j.appender.kafkaAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
+log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
+log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+log4j.appender.stateChangeAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH
+log4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log
+log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+log4j.appender.requestAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH
+log4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log
+log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+log4j.appender.cleanerAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH
+log4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log
+log4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+log4j.appender.controllerAppender=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH
+log4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log
+log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout
+log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
+
+# Turn on all our debugging info
+#log4j.logger.kafka.producer.async.DefaultEventHandler=DEBUG, kafkaAppender
+#log4j.logger.kafka.client.ClientUtils=DEBUG, kafkaAppender
+#log4j.logger.kafka.perf=DEBUG, kafkaAppender
+#log4j.logger.kafka.perf.ProducerPerformance$ProducerThread=DEBUG, 
kafkaAppender
+#log4j.logger.org.I0Itec.zkclient.ZkClient=DEBUG
+log4j.logger.kafka=INFO, kafkaAppender
+log4j.logger.kafka.network.RequestChannel$=WARN, requestAppender
+log4j.additivity.kafka.network.RequestChannel$=false
+
+#log4j.logger.kafka.network.Processor=TRACE, requestAppender
+#log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender
+#log4j.additivity.kafka.server.KafkaApis=false
+log4j.logger.kafka.request.logger=WARN, requestAppender
+log4j.additivity.kafka.request.logger=false
+
+log4j.logger.kafka.controller=TRACE, controllerAppender
+log4j.additivity.kafka.controller=false
+
+log4j.logger.kafka.log.LogCleaner=INFO, cleanerAppender
+log4j.additivity.kafka.log.LogCleaner=false
+
+log4j.logger.state.change.logger=TRACE, stateChangeAppender
+log4j.additivity.state.change.logger=false
+
+   </value>
+  </property>
+
+</configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
new file mode 100644
index 0000000..8e7aa64
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metainfo.xml
@@ -0,0 +1,82 @@
+<?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>KAFKA</name>
+      <displayName>Kafka</displayName>
+      <comment>A high-throughput distributed messaging system</comment>
+      <version>0.8.1.2.2</version>
+      <components>
+        <component>
+          <name>KAFKA_BROKER</name>
+          <displayName>Kafka Broker</displayName>
+          <category>MASTER</category>
+          <cardinality>1+</cardinality>
+          <dependencies>
+            <dependency>
+              <name>ZOOKEEPER/ZOOKEEPER_SERVER</name>
+              <scope>cluster</scope>
+              <auto-deploy>
+                <enabled>true</enabled>
+              </auto-deploy>
+            </dependency>
+          </dependencies>
+          <commandScript>
+            <script>scripts/kafka_broker.py</script>
+            <scriptType>PYTHON</scriptType>
+            <timeout>600</timeout>
+          </commandScript>
+        </component>
+      </components>
+      <osSpecifics>
+        <osSpecific>
+          <osFamily>redhat5,redhat6,suse11</osFamily>
+          <packages>
+            <package>
+              <name>kafka_2_2_*</name>
+            </package>
+          </packages>
+        </osSpecific>
+        <osSpecific>
+          <osFamily>ubuntu12</osFamily>
+          <packages>
+            <package>
+              <name>kafka-2-2-.*</name>
+            </package>
+          </packages>
+        </osSpecific>
+      </osSpecifics>
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+      <requiredServices>
+        <service>ZOOKEEPER</service>
+      </requiredServices>
+      <configuration-dependencies>
+        <config-type>kafka-broker</config-type>
+        <config-type>kafka-env</config-type>
+        <config-type>kafka-log4j</config-type>
+      </configuration-dependencies>
+      <restartRequiredAfterChange>true</restartRequiredAfterChange>
+    </service>
+  </services>
+</metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metrics.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metrics.json 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metrics.json
new file mode 100644
index 0000000..826c0e8
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/metrics.json
@@ -0,0 +1,262 @@
+{
+  "KAFKA_BROKER": {
+    "Component": [
+      {
+        "type": "ganglia",
+        "metrics": {
+          "metrics/jvm/uptime":{
+            "metric":"jvm.uptime",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/heap_usage":{
+            "metric":"jvm.heap_usage",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/non_heap_usage":{
+            "metric":"jvm.non_heap_usage",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/thread-states/runnable":{
+            "metric":"jvm.thread-states.runnable",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/thread-states/blocked":{
+            "metric":"jvm.thread-states.blocked",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/thread-states/timed_waiting":{
+            "metric":"jvm.thread-states.timed_waiting",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/thread-states/terminated":{
+            "metric":"jvm.thread-states.terminated",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/thread_count":{
+            "metric":"jvm.thread_count",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/jvm/daemon_thread_count":{
+            "metric":"jvm.daemon_thread_count",
+            "pointInTime":true,
+            "temporal":true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/1MinuteRate":
 {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsMessagesInPerSec.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/5MinuteRate":
 {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsMessagesInPerSec.5MinuteRate",
+            "pointInTime": false,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/15MinuteRate":
 {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsMessagesInPerSec.15MinuteRate",
+            "pointInTime": false,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/meanRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics/AllTopicsMessagesInPerSec/meanRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/count": {
+            "metric": 
"kafka.server.BrokerTopicMetrics/AllTopicsMessagesInPerSec.counte",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/1MinuteRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesInPerSec.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/5MinuteRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesInPerSec.5MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/15MinuteRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesInPerSec.15MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/meanRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesInPerSec.meanRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/count": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesInPerSec.count",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/1MinuteRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesOutPerSec.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/5MinuteRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesOutPerSec.5MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/15MinuteRate": 
{
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesOutPerSec.15MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/meanRate": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesOutPerSec.meanRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/count": {
+            "metric": 
"kafka.server.BrokerTopicMetrics.AllTopicsBytesOutPerSec.count",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/controller/KafkaController/ActiveControllerCount": {
+            "metric": "kafka.controller.KafkaController.ActiveControllerCount",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/meanRate": {
+            "metric": "kafka.log.LogFlushStats.LogFlushRateAndTimeMs.meanRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/1MinuteRate": 
{
+            "metric": 
"kafka.log.LogFlushStats.LogFlushRateAndTimeMs.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/5MinuteRate": 
{
+            "metric": 
"kafka.log.LogFlushStats.LogFlushRateAndTimeMs.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/15MinuteRate": {
+            "metric": 
"kafka.log.LogFlushStats.LogFlushRateAndTimeMs.15MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/count": {
+            "metric": "kafka.log.LogFlushStats.LogFlushRateAndTimeMs.count",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/meanRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.meanRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/1MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/5MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.5MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/15MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.15MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/count": {
+            "metric": 
"kafka.controller.ControllerStats.LeaderElectionRateAndTimeMs.count",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/UncleanLeaderElectionsPerSec/1MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.UncleanLeaderElectionsPerSec.1MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/UncleanLeaderElectionsPerSec/5MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.UncleanLeaderElectionsPerSec.5MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          
"metrics/kafka/controller/ControllerStats/UncleanLeaderElectionsPerSec/15MinuteRate":
 {
+            "metric": 
"kafka.controller.ControllerStats.UncleanLeaderElectionsPerSec.15MinuteRate",
+            "pointInTime": true,
+            "temporal": true
+          },
+          "metrics/kafka/controller/ControllerStats/OfflinePartitionsCount": {
+              "metric": 
"kafka.controller.ControllerStats.OfflinePartitionsCount",
+              "pointInTime" :true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ReplicaManager/PartitionCount": {
+              "metric": "kafka.server.ReplicaManager.PartitionCount",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ReplicaManager/LeaderCount": {
+              "metric": "kafka.server.ReplicaManager.LeaderCount",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ReplicaManager/UnderReplicatedPartitions": {
+              "metric": 
"kafka.server.ReplicaManager.UnderReplicatedPartitions",
+              "pointInTime" :true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ReplicaManager/ISRShrinksPerSec": {
+              "metric": "kafka.server.ReplicaManager.ISRShrinksPerSec",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ReplicaManager/ISRExpandsPerSec": {
+              "metric": "kafka.server.ReplicaManager.ISRExpandsPerSec",
+              "pointInTime" : true,
+              "temporal": true
+          },
+
+          "metrics/kafka/server/ReplicaFetcherManager/Replica-MaxLag": {
+              "metric": "kafka.server.ReplicaFetcherManager.Replica-MaxLag",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/server/ProducerRequestPurgatory/PurgatorySize": {
+              "metric": "kafka.server.ProducerRequestPurgatory.PurgatorySize",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/server/FetchRequestPurgatory/PurgatorySize": {
+              "metric": "kafka.server.FetchRequestPurgatory.PurgatorySize",
+              "pointInTime" : true,
+              "temporal": true
+          },
+          "metrics/kafka/cluster/Partition/$1-UnderReplicated":{
+            "metric":"kafka.cluster.Partition.(\\w+)-UnderReplicated",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/kafka/consumer/ConsumerFetcherManager/$1-MaxLag":{
+            "metric":"kafka.consumer.ConsumerFetcherManager.(\\w+)-MaxLag",
+            "pointInTime":true,
+            "temporal":true
+          },
+          "metrics/kafka/consumer/ConsumerFetcherManager/$1-MinFetch":{
+            "metric":"kafka.consumer.ConsumerFetcherManager.(\\w+)-MinFetch",
+            "pointInTime":true,
+            "temporal":true
+          }
+        }
+      }
+    ]
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
new file mode 100644
index 0000000..c0231a8
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka.py
@@ -0,0 +1,70 @@
+#!/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 resource_management import *
+from properties_config import properties_config
+import sys
+from copy import deepcopy
+
+def kafka():
+    import params
+
+    Directory([params.log_dir, params.pid_dir, params.conf_dir],
+              owner=params.kafka_user,
+              group=params.user_group,
+              recursive=True
+          )
+    brokerid = str(sorted(params.kafka_hosts).index(params.hostname))
+    kafka_server_config = 
mutable_config_dict(params.config['configurations']['kafka-broker'])
+    kafka_server_config['broker.id'] = brokerid
+    kafka_server_config['host.name'] = params.hostname
+    kafka_data_dir = kafka_server_config['log.dirs']
+    Directory(filter(None,kafka_data_dir.split(",")),
+              owner=params.kafka_user,
+              group=params.user_group,
+              recursive=True)
+
+    conf_dir = params.conf_dir
+    properties_config("server.properties",
+                      conf_dir=params.conf_dir,
+                      configurations=kafka_server_config,
+                      owner=params.kafka_user,
+                      group=params.user_group,
+                      brokerid=brokerid)
+
+    File(format("{conf_dir}/kafka-env.sh"),
+          owner=params.kafka_user,
+          content=InlineTemplate(params.kafka_env_sh_template)
+     )
+
+    if (params.log4j_props != None):
+        File(format("{conf_dir}/log4j.properties"),
+             mode=0644,
+             group=params.user_group,
+             owner=params.kafka_user,
+             content=params.log4j_props
+         )
+
+
+def mutable_config_dict(kafka_broker_config):
+    kafka_server_config = {}
+    for key, value in kafka_broker_config.iteritems():
+        kafka_server_config[key] = value
+    return kafka_server_config

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
new file mode 100644
index 0000000..c79ebb9
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/kafka_broker.py
@@ -0,0 +1,63 @@
+"""
+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 *
+import sys
+
+from kafka import kafka
+
+class KafkaBroker(Script):
+  def install(self, env):
+    self.install_packages(env)
+    self.configure(env)
+
+  def configure(self, env):
+    import params
+    env.set_params(params)
+    kafka()
+
+  def start(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+    daemon_cmd = format('source {params.conf_dir}/kafka-env.sh ; 
{params.kafka_bin} start')
+    no_op_test = format('ls {params.pid_file} >/dev/null 2>&1 && ps -p `cat 
{params.pid_file}` >/dev/null 2>&1')
+    Execute(daemon_cmd,
+            user=params.kafka_user,
+            not_if=no_op_test
+    )
+
+  def stop(self, env):
+    import params
+    env.set_params(params)
+    self.configure(env)
+    daemon_cmd = format('source {params.conf_dir}/kafka-env.sh; 
{params.kafka_bin} stop')
+    Execute(daemon_cmd,
+            user=params.kafka_user,
+    )
+    Execute (format("rm -f {params.pid_file}"))
+
+
+  def status(self, env):
+    import status_params
+    env.set_params(status_params)
+    check_process_status(status_params.kafka_pid_file)
+
+if __name__ == "__main__":
+  KafkaBroker().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/params.py
new file mode 100644
index 0000000..dc98526
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/params.py
@@ -0,0 +1,57 @@
+#!/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 resource_management.libraries.functions.version import 
format_hdp_stack_version, compare_versions
+from resource_management import *
+import status_params
+
+# server configurations
+config = Script.get_config()
+
+hdp_stack_version = str(config['hostLevelParams']['stack_version'])
+hdp_stack_version = format_hdp_stack_version(hdp_stack_version)
+
+if hdp_stack_version != "" and compare_versions(hdp_stack_version, '2.2') >= 0:
+    kafka_home = '/usr/hdp/current/kafka-broker/'
+    kafka_bin = kafka_home+'bin/kafka'
+else:
+    kafka_home = '/usr/lib/kafka/'
+    kafka_bin = kafka_home+'/bin/kafka'
+
+
+conf_dir = "/etc/kafka/conf"
+kafka_user = config['configurations']['kafka-env']['kafka_user']
+log_dir = config['configurations']['kafka-env']['kafka_log_dir']
+pid_dir = status_params.kafka_pid_dir
+pid_file = pid_dir+"/kafka.pid"
+hostname = config['hostname']
+user_group = config['configurations']['cluster-env']['user_group']
+java64_home = config['hostLevelParams']['java_home']
+kafka_env_sh_template = config['configurations']['kafka-env']['content']
+kafka_hosts = config['clusterHostInfo']['kafka_broker_hosts']
+kafka_hosts.sort()
+
+zookeeper_hosts = config['clusterHostInfo']['zookeeper_hosts']
+zookeeper_hosts.sort()
+
+if (('kafka-log4j' in config['configurations']) and ('content' in 
config['configurations']['kafka-log4j'])):
+    log4j_props = config['configurations']['kafka-log4j']['content']
+else:
+    log4j_props = None

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
new file mode 100644
index 0000000..56bab2c
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/properties_config.py
@@ -0,0 +1,32 @@
+#!/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.
+
+"""
+
+import re
+from resource_management import *
+
+def properties_inline_template(configurations):
+  return source.InlineTemplate('''{% for key, value in 
configurations_dict.items() %}{{ key }}={{ value }}
+{% endfor %}''', configurations_dict=configurations)
+
+def properties_config(filename, configurations = None, conf_dir = None,
+                      mode = None, owner = None, group = None, brokerid = 
None):
+    config_content = properties_inline_template(configurations)
+    File (format("{conf_dir}/{filename}"), content = config_content, owner = 
owner,
+          group = group, mode = mode)

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
new file mode 100644
index 0000000..c2b4bc1
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
@@ -0,0 +1,65 @@
+#!/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 __future__ import print_function
+from resource_management import *
+import  sys,subprocess,os
+
+class ServiceCheck(Script):
+    def service_check(self, env):
+        import params
+        env.set_params(params)
+        kafka_config=self.read_kafka_config(params.conf_dir)
+        self.set_env(params.conf_dir)
+        create_topic_cmd_created_output = "Created topic 
\"ambari_kafka_service_check\"."
+        create_topic_cmd_exists_output = "Topic \"ambari_kafka_service_check\" 
already exists."
+       print("Running kafka create topic command", file=sys.stdout)
+        create_topic_cmd = [params.kafka_home+'/bin/kafka-topics.sh', 
'--zookeeper '+kafka_config['zookeeper.connect'],
+                            '--create --topic ambari_kafka_service_check', 
'--partitions 1 --replication-factor 1']
+       print(" ".join(create_topic_cmd), file=sys.stdout)
+        create_topic_process = 
subprocess.Popen(create_topic_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+        out, err = create_topic_process.communicate()
+        if out.find(create_topic_cmd_created_output) != -1:
+           print(out, file=sys.stdout)
+            sys.exit(0)
+        elif out.find(create_topic_cmd_exists_output) != -1:
+            print("Topic ambari_kafka_service_check exists", file=sys.stdout)
+            sys.exit(0)
+        else:
+           print(out, file=sys.stderr)
+            sys.exit(1)
+
+    def read_kafka_config(self,kafka_conf_dir):
+        conf_file = open(kafka_conf_dir+"/server.properties","r")
+        kafka_config = {}
+        for line in conf_file:
+            key,value = line.split("=")
+            kafka_config[key] = value.replace("\n","")
+        return kafka_config
+
+    def set_env(self, kafka_conf_dir):
+        command = ['bash', '-c', 'source '+kafka_conf_dir+'/kafka-env.sh && 
env']
+        proc = subprocess.Popen(command, stdout = subprocess.PIPE)
+        for line in proc.stdout:
+            (key, _, value) = line.partition("=")
+            os.environ[key] = value.replace("\n","")
+        proc.communicate()
+
+if __name__ == "__main__":
+    ServiceCheck().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/status_params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/status_params.py
 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/status_params.py
new file mode 100644
index 0000000..fcb0816
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/status_params.py
@@ -0,0 +1,26 @@
+#!/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 resource_management import *
+
+config = Script.get_config()
+
+kafka_pid_dir = config['configurations']['kafka-env']['kafka_pid_dir']
+kafka_pid_file = format("{kafka_pid_dir}/kafka.pid")

http://git-wip-us.apache.org/repos/asf/ambari/blob/ef7fe6b5/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json 
b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json
new file mode 100644
index 0000000..e063da7
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/alerts.json
@@ -0,0 +1,32 @@
+{
+  "KNOX": {
+    "service": [],
+    "KNOX_GATEWAY": [
+      {
+        "name": "knox_gateway_process",
+        "label": "Know Gateway Process",
+        "description": "This host-level alert is triggered if the Knox Gateway 
cannot be determined to be up.",
+        "interval": 1,
+        "scope": "HOST",
+        "source": {
+          "type": "PORT",
+          "uri": "{{gateway-site/gateway.port}}",
+          "default_port": 8443,
+          "reporting": {
+            "ok": {
+              "text": "TCP OK - {0:.3f}s response on port {1}"
+            },
+            "warning": {
+              "text": "TCP OK - {0:.3f}s response on port {1}",
+              "value": 1.5
+            },
+            "critical": {
+              "text": "Connection failed: {0} to {1}:{2}",
+              "value": 5.0
+            }
+          }
+        }
+      }
+    ]
+  }
+}

Reply via email to