voltage monitoring added for raspi
This commit is contained in:
parent
a9e9ac1974
commit
12f9e57ea7
27
check_raspi_voltage
Executable file
27
check_raspi_voltage
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/python3
|
||||||
|
#
|
||||||
|
import argparse
|
||||||
|
import nagios
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
throttled = subprocess.check_output(['vcgencmd', 'get_throttled']).decode('utf-8')
|
||||||
|
try:
|
||||||
|
tval = throttled[throttled.index('=')+1:]
|
||||||
|
tval = int(tval, 16)
|
||||||
|
except ValueError:
|
||||||
|
tval = None
|
||||||
|
#
|
||||||
|
n = nagios.Nagios()
|
||||||
|
#
|
||||||
|
if tval is None:
|
||||||
|
status = n.UNKNOWN
|
||||||
|
elif tval & 0x4000 != 0:
|
||||||
|
status = n.ERROR
|
||||||
|
elif tval != 0:
|
||||||
|
status = n.WARNING
|
||||||
|
else:
|
||||||
|
status = n.OK
|
||||||
|
#
|
||||||
|
n.exit(status, f"Overtemperature state ({throttled})")
|
Loading…
x
Reference in New Issue
Block a user