Repository: ambari Updated Branches: refs/heads/trunk 344542082 -> 1f2b64979
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/1f2b6497 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1f2b6497 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1f2b6497 Branch: refs/heads/trunk Commit: 1f2b64979e2a033a092e00cb5a22ba7b50ea08e9 Parents: 3445420 Author: oleewere <[email protected]> Authored: Tue Jun 21 01:17:05 2016 +0200 Committer: oleewere <[email protected]> Committed: Tue Jun 21 01:22:46 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 ++- .../test/python/stacks/2.4/configs/default.json | 4 +++ 5 files changed, 57 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1f2b6497/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/1f2b6497/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/1f2b6497/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/1f2b6497/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"] } } http://git-wip-us.apache.org/repos/asf/ambari/blob/1f2b6497/ambari-server/src/test/python/stacks/2.4/configs/default.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.4/configs/default.json b/ambari-server/src/test/python/stacks/2.4/configs/default.json index 10e4660..ff548e0 100644 --- a/ambari-server/src/test/python/stacks/2.4/configs/default.json +++ b/ambari-server/src/test/python/stacks/2.4/configs/default.json @@ -260,6 +260,7 @@ "logsearch_log_dir": "/var/log/ambari-logsearch-portal", "logsearch_debug_enabled": "false", "logsearch_debug_port": "5005", + "logsearch_ui_port" : "61888", "logsearch_solr_audit_logs_use_ranger": "false", "logsearch_solr_jmx_port": "18886", "content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements. See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License. You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#solr.url=http://{{solr_host}}:{{solr_port}}/solr\n\n#Service Logs and History colletion\nlogsearch.solr.zkhosts={{zookeeper_quorum}}{{solr_znode}}\nlogsearch.solr.collection.ser vice.logs={{logsearch_collection_service_logs}}\nlogsearch.solr.collection.history=history\n\nlogsearch.service.logs.split.interval.mins={{logsearch_service_logs_split_interval_mins}}\nlogsearch.collection.service.logs.numshards={{logsearch_collection_service_logs_numshards}}\nlogsearch.collection.service.logs.replication.factor={{logsearch_collection_service_logs_replication_factor}}\n\nlogsearch.service.logs.fields={{logsearch_service_logs_fields}}\n\n#Audit logs\nlogsearch.solr.audit.logs.zkhosts={{logsearch_solr_audit_logs_zk_quorum}}{{logsearch_solr_audit_logs_zk_node}}\nogsearch.solr.collection.audit.logs={{solr_collection_audit_logs}}\nlogsearch.solr.audit.logs.url={{logsearch_solr_audit_logs_url}}\n\nlogsearch.audit.logs.split.interval.mins={{logsearch_audit_logs_split_interval_mins}}\nlogsearch.collection.audit.logs.numshards={{logsearch_collection_audit_logs_numshards}}\nlogsearch.collection.audit.logs.replication.factor={{logsearch_collection_audit_logs_replication_factor }}\n{% if logsearch_solr_ssl_enabled %}\nexport LOGSEARCH_SOLR_SSL_ENABLED=\"true\"\nexport LOGSEARCH_SOLR_SSL_CLIENT_KEYSTORE_LOCATION={{logsearch_solr_ssl_client_keystore_location}}\nexport LOGSEARCH_SOLR_SSL_CLIENT_KEYSTORE_PASSWORD={{logsearch_solr_ssl_client_keystore_password}}\nexport LOGSEARCH_SOLR_SSL_CLIENT_KEYSTORE_TYPE={{logsearch_solr_ssl_client_keystore_type}}\nexport LOGSEARCH_SOLR_SSL_CLIENT_TRUSTSTORE_LOCATION={{logsearch_solr_ssl_client_truststore_location}}\nexport LOGSEARCH_SOLR_SSL_CLIENT_TRUSTSTORE_PASSWORD={{logsearch_solr_ssl_client_truststore_password}}\nexport LOGSEARCH_SOLR_SSL_CLIENT_TRUSTSTORE_TYPE={{logsearch_solr_ssl_client_truststore_type}}\n{% endif %}" @@ -417,6 +418,9 @@ ], "logsearch_solr_hosts": [ "c6401.ambari.apache.org" + ], + "logsearch_server_hosts" : [ + "c6401.ambari.apache.org" ] } }
