]> git.parisson.com Git - telecaster-server.git/commitdiff
send all messages, fix monitor message
authorGuillaume Pellerin <yomguy@parisson.com>
Wed, 13 Mar 2024 11:25:21 +0000 (12:25 +0100)
committerGuillaume Pellerin <guillaume.pellerin@free.fr>
Wed, 13 Mar 2024 11:25:57 +0000 (12:25 +0100)
bin/monitoring/check_telecaster.py

index 49118cd69db47ec8e6739aaea028db705337f2c2..b2dfe50c26b66058a705e1b5a4d3499137b26242 100755 (executable)
@@ -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)