Fix and reduction of undervoltage only
This commit is contained in:
parent
12f9e57ea7
commit
9bcf1fc486
@ -4,6 +4,19 @@ import argparse
|
|||||||
import nagios
|
import nagios
|
||||||
import subprocess
|
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__":
|
if __name__ == "__main__":
|
||||||
throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
|
throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
|
||||||
@ -12,15 +25,15 @@ if __name__ == "__main__":
|
|||||||
tval = int(tval, 16)
|
tval = int(tval, 16)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
tval = None
|
tval = None
|
||||||
|
else:
|
||||||
|
tval &= 0x3fff # remove the values which are only resetted with a reboot
|
||||||
#
|
#
|
||||||
n = nagios.Nagios()
|
n = nagios.Nagios()
|
||||||
#
|
#
|
||||||
if tval is None:
|
if tval is None:
|
||||||
status = n.UNKNOWN
|
status = n.UNKNOWN
|
||||||
elif tval & 0x4000 != 0:
|
elif tval & 0x1 != 0:
|
||||||
status = n.ERROR
|
status = n.ERROR
|
||||||
elif tval != 0:
|
|
||||||
status = n.WARNING
|
|
||||||
else:
|
else:
|
||||||
status = n.OK
|
status = n.OK
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user