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
 import nagios
4
 import nagios
5
 import subprocess
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
 if __name__ == "__main__":
21
 if __name__ == "__main__":
9
     throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
22
     throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
12
         tval = int(tval, 16)
25
         tval = int(tval, 16)
13
     except ValueError:
26
     except ValueError:
14
         tval = None
27
         tval = None
28
+    else:
29
+        tval &= 0x3fff  # remove the values which are only resetted with a reboot
15
     #
30
     #
16
     n = nagios.Nagios()
31
     n = nagios.Nagios()
17
     #
32
     #
18
     if tval is None:
33
     if tval is None:
19
         status = n.UNKNOWN
34
         status = n.UNKNOWN
20
-    elif tval & 0x4000 != 0:
35
+    elif tval & 0x1 != 0:
21
         status = n.ERROR
36
         status = n.ERROR
22
-    elif tval != 0:
23
-        status = n.WARNING
24
     else:
37
     else:
25
         status = n.OK
38
         status = n.OK
26
     #
39
     #

Loading…
Cancel
Save