Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 62cefee4a -> 656a4c146


AMBARI-16899. Service check for logsearch server (oleewere)


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

Branch: refs/heads/branch-2.4
Commit: 656a4c146659a6d222cdcc6a79962c9d63f00217
Parents: 62cefee
Author: oleewere <[email protected]>
Authored: Mon Jun 20 17:28:00 2016 +0200
Committer: oleewere <[email protected]>
Committed: Mon Jun 20 17:30:14 2016 +0200

----------------------------------------------------------------------
 .../LOGSEARCH/0.5.0/metainfo.xml                |  6 ++++
 .../LOGSEARCH/0.5.0/package/scripts/params.py   |  6 ++++
 .../0.5.0/package/scripts/service_check.py      | 38 ++++++++++++++++++++
 .../services/LOGSEARCH/role_command_order.json  |  4 ++-
 4 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/656a4c14/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
index 48451a0..e3a8f98 100644
--- 
a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
+++ 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/metainfo.xml
@@ -219,6 +219,12 @@
         </osSpecific>
       </osSpecifics>
 
+      <commandScript>
+        <script>scripts/service_check.py</script>
+        <scriptType>PYTHON</scriptType>
+        <timeout>300</timeout>
+      </commandScript>
+
       <requiredServices>
         <service>ZOOKEEPER</service>
       </requiredServices>

http://git-wip-us.apache.org/repos/asf/ambari/blob/656a4c14/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
index 8a1449d..5afc04c 100644
--- 
a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
+++ 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/params.py
@@ -326,3 +326,9 @@ 
logfeeder_custom_properties.pop('logfeeder.checkpoint.folder', None)
 logfeeder_custom_properties.pop('logfeeder.metrics.collector.hosts', None)
 logfeeder_custom_properties.pop('logfeeder.log.filter.enable', None)
 logfeeder_custom_properties.pop('logfeeder.solr.config.interval', None)
+
+logsearch_server_hosts = config['clusterHostInfo']['logsearch_server_hosts']
+logsearch_server_host = ""
+if logsearch_server_hosts is not None and len(logsearch_server_hosts) > 0:
+  logsearch_server_host = logsearch_server_hosts[0]
+smoke_logsearch_cmd = format('curl -s -o /dev/null -w "%{{http_code}}" 
http://{logsearch_server_host}:{logsearch_ui_port}/login.jsp | grep 200')

http://git-wip-us.apache.org/repos/asf/ambari/blob/656a4c14/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/service_check.py
 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/service_check.py
new file mode 100644
index 0000000..2993190
--- /dev/null
+++ 
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/service_check.py
@@ -0,0 +1,38 @@
+"""
+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.script.script import Script
+from resource_management.core.logger import Logger
+from resource_management.core.resources.system import Execute
+
+class LogSearchServiceCheck(Script):
+  def service_check(self, env):
+    import params
+    env.set_params(params)
+
+    try:
+      Execute(params.smoke_logsearch_cmd, user=params.logsearch_user, timeout 
= 10)
+      Logger.info('Log Search Server up and running')
+    except:
+      Logger.debug('Log Search Server not running')
+
+
+
+if __name__ == "__main__":
+  LogSearchServiceCheck().execute()
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/656a4c14/ambari-server/src/main/resources/stacks/HDP/2.2/services/LOGSEARCH/role_command_order.json
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/LOGSEARCH/role_command_order.json
 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/LOGSEARCH/role_command_order.json
index 4e6c6cd..705fd10 100755
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.2/services/LOGSEARCH/role_command_order.json
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.2/services/LOGSEARCH/role_command_order.json
@@ -3,6 +3,8 @@
     "_comment" : "dependencies for logsearch",
     "LOGSEARCH_SOLR-START" : ["ZOOKEEPER_SERVER-START"],
     "LOGSEARCH_SERVER-START": ["LOGSEARCH_SOLR-START"],
-    "LOGSEARCH_LOGFEEDER-START": ["LOGSEARCH_SOLR-START", 
"LOGSEARCH_SERVER-START"]
+    "LOGSEARCH_LOGFEEDER-START": ["LOGSEARCH_SOLR-START", 
"LOGSEARCH_SERVER-START"],
+    "LOGSEARCH_SERVICE_CHECK-SERVICE_CHECK": ["LOGSEARCH_SOLR-START", 
"LOGSEARCH_SERVER-START"],
+    "LOGSEARCH_SERVER-RESTART" : ["LOGSEARCH_SOLR-RESTART"]
   }
 }

Reply via email to