You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2014/07/15 20:38:53 UTC
git commit: AMBARI-6492. Flume: cleanup alert when none are found or
single instance is running (ncole)
Repository: ambari
Updated Branches:
refs/heads/trunk a4c242b8b -> 4eb552e7d
AMBARI-6492. Flume: cleanup alert when none are found or single instance is running (ncole)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4eb552e7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4eb552e7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4eb552e7
Branch: refs/heads/trunk
Commit: 4eb552e7d7386008c5030ec755b6e71c2a3370a0
Parents: a4c242b
Author: Nate Cole <nc...@hortonworks.com>
Authored: Tue Jul 15 13:50:26 2014 -0400
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Tue Jul 15 14:38:36 2014 -0400
----------------------------------------------------------------------
.../NAGIOS/package/files/check_ambari_alerts.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/4eb552e7/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 912a209..2e17b77 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
@@ -44,14 +44,14 @@ def main():
exit(-1)
if not os.path.exists(options.alert_file):
- print "Alert file must exist"
- exit(-1)
+ print "Status is unreported"
+ exit(3)
try:
with open(options.alert_file, 'r') as f:
data = json.load(f)
- first = True
+ found = False
buf = ''
for_hosts = data[options.alert_name]
@@ -66,13 +66,17 @@ def main():
print str(alert_text)
exit(1)
else:
- if not first:
+ if found:
buf = buf + ', '
buf = buf + alert_text
- first = False
+ found = True
- print buf
- exit(0)
+ if not found:
+ print "Status is not reported"
+ exit(3)
+ else:
+ print buf
+ exit(0)
except Exception:
traceback.print_exc()