From 9bcf1fc486ee335dc5b4d7e22d5475609e37f9b9 Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Sun, 7 Jan 2024 13:21:48 +0100 Subject: [PATCH] Fix and reduction of undervoltage only --- check_raspi_voltage | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/check_raspi_voltage b/check_raspi_voltage index ccc5f23..67143db 100755 --- a/check_raspi_voltage +++ b/check_raspi_voltage @@ -4,6 +4,19 @@ import argparse import nagios import subprocess +""" +Bit Hex Value Meaning +0 1 Under-voltage detected +1 2 ARM frequency has been caped +2 4 Currently throttled +3 8 Soft temperature limit is active +16 1000 Under-voltage has occurred +17 2000 ARM frequency capping has occurred +18 4000 Throttling has occurred +19 8000 Soft temperature limit has occurred + +Bit16+ are resetted with a reboot (only) +""" if __name__ == "__main__": throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8') @@ -12,15 +25,15 @@ if __name__ == "__main__": tval = int(tval, 16) except ValueError: tval = None + else: + tval &= 0x3fff # remove the values which are only resetted with a reboot # n = nagios.Nagios() # if tval is None: status = n.UNKNOWN - elif tval & 0x4000 != 0: + elif tval & 0x1 != 0: status = n.ERROR - elif tval != 0: - status = n.WARNING else: status = n.OK #