Repository: ambari
Updated Branches:
  refs/heads/trunk 92c4d45f6 -> d2413e112


AMBARI-6758. Flume: alerts reported incorrectly by Nagios (ncole)


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

Branch: refs/heads/trunk
Commit: d2413e112941a48e10f8b3e8f33c509c3866c8b4
Parents: 92c4d45
Author: Nate Cole <nc...@hortonworks.com>
Authored: Wed Aug 6 14:32:10 2014 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Wed Aug 6 15:33:11 2014 -0400

----------------------------------------------------------------------
 .../NAGIOS/package/files/check_ambari_alerts.py | 27 ++++++++------------
 .../NAGIOS/package/files/check_wrapper.sh       |  2 +-
 2 files changed, 11 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d2413e11/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_ambari_alerts.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_ambari_alerts.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_ambari_alerts.py
index 2e17b77..833a798 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_ambari_alerts.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_ambari_alerts.py
@@ -51,32 +51,25 @@ def main():
     with open(options.alert_file, 'r') as f:
       data = json.load(f)
 
-      found = False
-      buf = ''
+      buf_list = []
+      exit_code = 0
 
       for_hosts = data[options.alert_name]
       if for_hosts.has_key(options.host):
         for host_entry in for_hosts[options.host]:
+          buf_list.append(host_entry['text'])
           alert_state = host_entry['state']
-          alert_text = host_entry['text']
-          if alert_state == 'CRITICAL':
-            print str(alert_text)
-            exit(2)
-          elif alert_state == 'WARNING':
-            print str(alert_text)
-            exit(1)
-          else:
-            if found:
-              buf = buf + ', '
-            buf = buf + alert_text
-            found = True
+          if alert_state == 'CRITICAL' and exit_code < 2:
+            exit_code = 2
+          elif alert_state == 'WARNING' and exit_code < 1:
+            exit_code = 1
 
-      if not found:
+      if 0 == len(buf_list):
         print "Status is not reported"
         exit(3)
       else:
-        print buf
-        exit(0)
+        print ", ".join(buf_list)
+        exit(exit_code)
       
   except Exception:
     traceback.print_exc()

http://git-wip-us.apache.org/repos/asf/ambari/blob/d2413e11/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_wrapper.sh
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_wrapper.sh
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_wrapper.sh
index 00390f2..d350e4f 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_wrapper.sh
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/NAGIOS/package/files/check_wrapper.sh
@@ -47,7 +47,7 @@ function real_component() {
       realCompName="HIVE_SERVER"
     ;;
     FLUME)
-      realCompName="FLUME_SERVER"
+      realCompName="FLUME_HANDLER"
     ;;
     HUE)
       realCompName="HUE_SERVER"

Reply via email to