This is an automated email from the ASF dual-hosted git repository. aonishuk pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new 223cabc AMBARI-23063. "Stale Alerts" alert has to be re-done properly (aonishuk) 223cabc is described below commit 223cabc5684ce7ee29a410ec3ac5ac987f9bae96 Author: Andrew Onishuk <aonis...@hortonworks.com> AuthorDate: Tue May 22 16:06:44 2018 +0300 AMBARI-23063. "Stale Alerts" alert has to be re-done properly (aonishuk) --- ambari-agent/conf/unix/ambari-agent.ini | 2 ++ ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py | 9 +++++---- ambari-agent/src/main/python/ambari_agent/AmbariConfig.py | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ambari-agent/conf/unix/ambari-agent.ini b/ambari-agent/conf/unix/ambari-agent.ini index c6cf803..8596790 100644 --- a/ambari-agent/conf/unix/ambari-agent.ini +++ b/ambari-agent/conf/unix/ambari-agent.ini @@ -41,6 +41,8 @@ command_reports_interval=5 status_commands_run_interval=20 alert_grace_period=5 status_command_timeout=5 +; (send_alert_changes_only) - enabling this is necessary to deploy big perf clusters +send_alert_changes_only=0 alert_kinit_timeout=14400000 system_resource_overrides=/etc/resource_overrides ; memory_threshold_soft_mb=400 diff --git a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py index 173c03b..dd17c5a 100644 --- a/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py +++ b/ambari-agent/src/main/python/ambari_agent/AlertStatusReporter.py @@ -42,6 +42,7 @@ class AlertStatusReporter(threading.Thread): self.stale_alerts_monitor = initializer_module.stale_alerts_monitor self.server_responses_listener = initializer_module.server_responses_listener self.reported_alerts = defaultdict(lambda:defaultdict(lambda:[])) + self.send_alert_changes_only = initializer_module.config.send_alert_changes_only threading.Thread.__init__(self) def run(self): @@ -58,11 +59,11 @@ class AlertStatusReporter(threading.Thread): self.clean_not_existing_clusters_info() alerts = self.collector.alerts() self.stale_alerts_monitor.save_executed_alerts(alerts) - changed_alerts = self.get_changed_alerts(alerts) + alerts_to_send = self.get_changed_alerts(alerts) if self.send_alert_changes_only else alerts - if changed_alerts and self.initializer_module.is_registered: - correlation_id = self.initializer_module.connection.send(message=changed_alerts, destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT, log_message_function=AlertStatusReporter.log_sending) - self.server_responses_listener.listener_functions_on_success[correlation_id] = lambda headers, message: self.save_results(changed_alerts) + if alerts_to_send and self.initializer_module.is_registered: + correlation_id = self.initializer_module.connection.send(message=alerts_to_send, destination=Constants.ALERTS_STATUS_REPORTS_ENDPOINT, log_message_function=AlertStatusReporter.log_sending) + self.server_responses_listener.listener_functions_on_success[correlation_id] = lambda headers, message: self.save_results(alerts_to_send) except ConnectionIsAlreadyClosed: # server and agent disconnected during sending data. Not an issue pass diff --git a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py index 4a5236b..1e95fbe 100644 --- a/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py +++ b/ambari-agent/src/main/python/ambari_agent/AmbariConfig.py @@ -340,6 +340,10 @@ class AmbariConfig: """ return self.get('security', 'ca_cert_path', default="") + @property + def send_alert_changes_only(self): + return bool(self.get('agent', 'send_alert_changes_only', '0')) + def isSameHostList(hostlist1, hostlist2): is_same = True -- To stop receiving notification emails like this one, please contact aonis...@apache.org.