-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_voltage.sh
34 lines (30 loc) · 1.04 KB
/
check_voltage.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# /opt/vc/bin/vcgencmd get_throttled
# If the answer is:
#
# throttled=0x0
# You're good with the supplied voltage and SoC temperature.
#
# The bits on the returned number mean:
#
# Bit Hex value Meaning
# 0 1 Under-voltage detected
# 1 2 Arm frequency capped
# 2 4 Currently throttled
# 3 8 Soft temperature limit active
# 16 10000 Under-voltage has occurred
# 17 20000 Arm frequency capping has occurred
# 18 40000 Throttling has occurred
# 19 80000 Soft temperature limit has occurred
# A value of 0x50000 means 16 & 18 -- from the boot moment up to now Under-Voltage has ocurred at some point as well as Throrrling has occured.
#
# nagios user needs permissions to use vcgencmd -> $ sudo usermod -aG video nagios
throttle=$(/opt/vc/bin/vcgencmd get_throttled)
if [ "$throttle" == "throttled=0x0" ]; then
echo "OK - no under-voltage/throttling: $throttle"
exit 0
else
echo "WARNING - under-voltage/throttling occured: $throttle"
exit 1
fi
exit 0