ambari git commit: AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki)
Repository: ambari Updated Branches: refs/heads/branch-2.2 29860c9ba -> 78c7755c0 AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/78c7755c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/78c7755c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/78c7755c Branch: refs/heads/branch-2.2 Commit: 78c7755c00e4142898403ab5bc3af89820ad80f2 Parents: 29860c9 Author: Jun AokiAuthored: Wed Feb 3 10:57:09 2016 -0800 Committer: Jun Aoki Committed: Wed Feb 3 10:57:09 2016 -0800 -- .../common-services/HAWQ/2.0.0/alerts.json | 19 ++ .../2.0.0/package/alerts/alert_sync_status.py | 91 + .../stacks/2.3/HAWQ/test_alert_sync_status.py | 194 +++ 3 files changed, 304 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/78c7755c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json new file mode 100644 index 000..3119a0c --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json @@ -0,0 +1,19 @@ +{ + "HAWQ": { +"HAWQMASTER": [ + { +"name": "hawqstandby_sync_status", +"label": "HAWQ Standby Sync Status", +"description": "This alert will trigger if HAWQ Standby is not synchronized with HAWQ Master", +"interval": 1, +"scope": "ANY", +"enabled": true, +"source": { + "type": "SCRIPT", + "path": "HAWQ/2.0.0/package/alerts/alert_sync_status.py", + "parameters": [] +} + } +] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/78c7755c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py new file mode 100644 index 000..c94be9e --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py @@ -0,0 +1,91 @@ +#!/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 logging +from resource_management.core.shell import call + +HAWQ_USER = 'gpadmin' +HAWQ_GREENPLUM_PATH_FILE = '/usr/local/hawq/greenplum_path.sh' + +HAWQMASTER_PORT = '{{hawq-site/hawq_master_address_port}}' +HAWQSTANDBY_ADDRESS = '{{hawq-site/hawq_standby_address_host}}' + +RESULT_STATE_OK = 'OK' +RESULT_STATE_WARNING = 'WARNING' +RESULT_STATE_UNKNOWN = 'UNKNOWN' +RESULT_STATE_SKIPPED = 'SKIPPED' + +logger = logging.getLogger('ambari_alerts') + + +def get_tokens(): + """ + Returns a tuple of tokens in the format {{site/property}} that will be used to build the dictionary passed into execute + """ + return (HAWQMASTER_PORT, HAWQSTANDBY_ADDRESS) + + +def execute(configurations={}, parameters={}, host_name=None): + """ + Returns a tuple containing the result code and a pre-formatted result label + + Keyword arguments: + configurations (dictionary): a mapping of configuration key to value + parameters (dictionary): a mapping of script parameter key to value + host_name (string): the name of this host where the alert is running + """ + + if configurations is None: +return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.']) + + # If HAWQSTANDBY is not installed on the cluster + if HAWQSTANDBY_ADDRESS not in configurations: + return (RESULT_STATE_SKIPPED, ['HAWQSTANDBY is not installed.']) + + try: +sync_status = get_sync_status(configurations[HAWQMASTER_PORT]) +if
ambari git commit: AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki)
Repository: ambari Updated Branches: refs/heads/trunk 7259d972e -> 424cca6c3 AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/424cca6c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/424cca6c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/424cca6c Branch: refs/heads/trunk Commit: 424cca6c3744eca2c44dff0fbc47791492845f88 Parents: 7259d97 Author: Jun AokiAuthored: Wed Feb 3 10:58:56 2016 -0800 Committer: Jun Aoki Committed: Wed Feb 3 10:58:56 2016 -0800 -- .../common-services/HAWQ/2.0.0/alerts.json | 19 ++ .../2.0.0/package/alerts/alert_sync_status.py | 91 + .../stacks/2.3/HAWQ/test_alert_sync_status.py | 194 +++ 3 files changed, 304 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/424cca6c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json new file mode 100644 index 000..3119a0c --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json @@ -0,0 +1,19 @@ +{ + "HAWQ": { +"HAWQMASTER": [ + { +"name": "hawqstandby_sync_status", +"label": "HAWQ Standby Sync Status", +"description": "This alert will trigger if HAWQ Standby is not synchronized with HAWQ Master", +"interval": 1, +"scope": "ANY", +"enabled": true, +"source": { + "type": "SCRIPT", + "path": "HAWQ/2.0.0/package/alerts/alert_sync_status.py", + "parameters": [] +} + } +] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/424cca6c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py new file mode 100644 index 000..c94be9e --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py @@ -0,0 +1,91 @@ +#!/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 logging +from resource_management.core.shell import call + +HAWQ_USER = 'gpadmin' +HAWQ_GREENPLUM_PATH_FILE = '/usr/local/hawq/greenplum_path.sh' + +HAWQMASTER_PORT = '{{hawq-site/hawq_master_address_port}}' +HAWQSTANDBY_ADDRESS = '{{hawq-site/hawq_standby_address_host}}' + +RESULT_STATE_OK = 'OK' +RESULT_STATE_WARNING = 'WARNING' +RESULT_STATE_UNKNOWN = 'UNKNOWN' +RESULT_STATE_SKIPPED = 'SKIPPED' + +logger = logging.getLogger('ambari_alerts') + + +def get_tokens(): + """ + Returns a tuple of tokens in the format {{site/property}} that will be used to build the dictionary passed into execute + """ + return (HAWQMASTER_PORT, HAWQSTANDBY_ADDRESS) + + +def execute(configurations={}, parameters={}, host_name=None): + """ + Returns a tuple containing the result code and a pre-formatted result label + + Keyword arguments: + configurations (dictionary): a mapping of configuration key to value + parameters (dictionary): a mapping of script parameter key to value + host_name (string): the name of this host where the alert is running + """ + + if configurations is None: +return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.']) + + # If HAWQSTANDBY is not installed on the cluster + if HAWQSTANDBY_ADDRESS not in configurations: + return (RESULT_STATE_SKIPPED, ['HAWQSTANDBY is not installed.']) + + try: +sync_status = get_sync_status(configurations[HAWQMASTER_PORT]) +if sync_status in
[15/16] ambari git commit: AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki)
AMBARI-14855: Add Alert for HAWQSTANDBY sync status with HAWQMASTER (mithmatt via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/424cca6c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/424cca6c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/424cca6c Branch: refs/heads/branch-dev-patch-upgrade Commit: 424cca6c3744eca2c44dff0fbc47791492845f88 Parents: 7259d97 Author: Jun AokiAuthored: Wed Feb 3 10:58:56 2016 -0800 Committer: Jun Aoki Committed: Wed Feb 3 10:58:56 2016 -0800 -- .../common-services/HAWQ/2.0.0/alerts.json | 19 ++ .../2.0.0/package/alerts/alert_sync_status.py | 91 + .../stacks/2.3/HAWQ/test_alert_sync_status.py | 194 +++ 3 files changed, 304 insertions(+) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/424cca6c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json new file mode 100644 index 000..3119a0c --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/alerts.json @@ -0,0 +1,19 @@ +{ + "HAWQ": { +"HAWQMASTER": [ + { +"name": "hawqstandby_sync_status", +"label": "HAWQ Standby Sync Status", +"description": "This alert will trigger if HAWQ Standby is not synchronized with HAWQ Master", +"interval": 1, +"scope": "ANY", +"enabled": true, +"source": { + "type": "SCRIPT", + "path": "HAWQ/2.0.0/package/alerts/alert_sync_status.py", + "parameters": [] +} + } +] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/424cca6c/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py -- diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py new file mode 100644 index 000..c94be9e --- /dev/null +++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/alerts/alert_sync_status.py @@ -0,0 +1,91 @@ +#!/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 logging +from resource_management.core.shell import call + +HAWQ_USER = 'gpadmin' +HAWQ_GREENPLUM_PATH_FILE = '/usr/local/hawq/greenplum_path.sh' + +HAWQMASTER_PORT = '{{hawq-site/hawq_master_address_port}}' +HAWQSTANDBY_ADDRESS = '{{hawq-site/hawq_standby_address_host}}' + +RESULT_STATE_OK = 'OK' +RESULT_STATE_WARNING = 'WARNING' +RESULT_STATE_UNKNOWN = 'UNKNOWN' +RESULT_STATE_SKIPPED = 'SKIPPED' + +logger = logging.getLogger('ambari_alerts') + + +def get_tokens(): + """ + Returns a tuple of tokens in the format {{site/property}} that will be used to build the dictionary passed into execute + """ + return (HAWQMASTER_PORT, HAWQSTANDBY_ADDRESS) + + +def execute(configurations={}, parameters={}, host_name=None): + """ + Returns a tuple containing the result code and a pre-formatted result label + + Keyword arguments: + configurations (dictionary): a mapping of configuration key to value + parameters (dictionary): a mapping of script parameter key to value + host_name (string): the name of this host where the alert is running + """ + + if configurations is None: +return (RESULT_STATE_UNKNOWN, ['There were no configurations supplied to the script.']) + + # If HAWQSTANDBY is not installed on the cluster + if HAWQSTANDBY_ADDRESS not in configurations: + return (RESULT_STATE_SKIPPED, ['HAWQSTANDBY is not installed.']) + + try: +sync_status = get_sync_status(configurations[HAWQMASTER_PORT]) +if sync_status in ('Synchronized', 'Synchronizing'): + return