From cb5102f48da5f17e1bcd9cc43db05523f0d2b0e8 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Wed, 13 Mar 2024 12:25:21 +0100 Subject: [PATCH] send all messages, fix monitor message --- bin/monitoring/check_telecaster.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/monitoring/check_telecaster.py b/bin/monitoring/check_telecaster.py index 49118cd..b2dfe50 100755 --- a/bin/monitoring/check_telecaster.py +++ b/bin/monitoring/check_telecaster.py @@ -56,7 +56,9 @@ class TelecasterCheck: for daemon in self.daemons: if not self.get_pid(daemon['proc'], args=daemon['args']): self.is_up = False - self.message += daemon['proc'] + " " + daemon['args'] + " is OFF" + "\n" + self.message += daemon['proc'] + " " + daemon['args'] + " is OFF" + " - " + else: + self.message += daemon['proc'] + " " + daemon['args'] + " is ON" + " - " def check_writing(self): for record_path in self.record_paths: @@ -78,7 +80,10 @@ class TelecasterCheck: if self.is_up: time.sleep(self.TIME_SLEEP) self.is_writing = False - self.message += format + " monitor is not writing\n" + self.message += format + " writing is OFF - " + else: + self.is_writing = True + self.message += format + " writing is ON - " f = open(log, 'w') f.write(str(size)) f.close() @@ -86,8 +91,8 @@ class TelecasterCheck: def run(self): self.check_daemons() self.check_writing() + print(self.message) if not self.is_up or not self.is_writing: - print(self.message) sys.exit(self.CRITICAL_STATE) else: sys.exit(self.OK_STATE) -- 2.39.5