Browse Source

Fix and reduction of undervoltage only

master
Dirk Alders 11 months ago
parent
commit
9bcf1fc486
1 changed files with 16 additions and 3 deletions
  1. 16
    3
      check_raspi_voltage

+ 16
- 3
check_raspi_voltage View File

@@ -4,6 +4,19 @@ import argparse
4 4
 import nagios
5 5
 import subprocess
6 6
 
7
+"""
8
+Bit	Hex     Value Meaning
9
+0	1	    Under-voltage detected
10
+1	2	    ARM frequency has been caped
11
+2	4	    Currently throttled
12
+3	8	    Soft temperature limit is active
13
+16	1000	Under-voltage has occurred
14
+17	2000	ARM frequency capping has occurred
15
+18	4000	Throttling has occurred
16
+19	8000	Soft temperature limit has occurred
17
+
18
+Bit16+ are resetted with a reboot (only)
19
+"""
7 20
 
8 21
 if __name__ == "__main__":
9 22
     throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
@@ -12,15 +25,15 @@ if __name__ == "__main__":
12 25
         tval = int(tval, 16)
13 26
     except ValueError:
14 27
         tval = None
28
+    else:
29
+        tval &= 0x3fff  # remove the values which are only resetted with a reboot
15 30
     #
16 31
     n = nagios.Nagios()
17 32
     #
18 33
     if tval is None:
19 34
         status = n.UNKNOWN
20
-    elif tval & 0x4000 != 0:
35
+    elif tval & 0x1 != 0:
21 36
         status = n.ERROR
22
-    elif tval != 0:
23
-        status = n.WARNING
24 37
     else:
25 38
         status = n.OK
26 39
     #

Loading…
Cancel
Save