Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

nagios: Change the cron jobs to exit 0 for all ok/warning/critical.

Alex Vandivera9337e7641d3
diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py
index e09c1e12834..a7c1917e719 100755
--- a/scripts/lib/zulip_tools.py
+++ b/scripts/lib/zulip_tools.py
@@ -755,7 +755,15 @@ def atomic_nagios_write(
with open(path + ".tmp", "w") as fh:
fh.write("|".join([str(event_time), str(status_int), status, message]) + "\n")
os.rename(path + ".tmp", path)
- return status_int
+
+ # Return code should be if the cron job ran to completion
+ # successfully, not if the result of the check was outside of
+ # bounds ("ok" / "critical"); this prevents the Sentry cron
+ # wrapper from spamming with a "failure" email if the nagios check
+ # requires multiple failures in a row.
+ if status == "unknown":
+ return 1
+ return 0
if __name__ == "__main__":