-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_pi_temp
40 lines (27 loc) · 841 Bytes
/
check_pi_temp
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
35
36
37
38
39
40
#!/bin/bash
#
# check_pi_temp: Check Raspberry Pi temperature
#
temp_input=$(cat /sys/class/thermal/thermal_zone0/temp)
temp=$(($temp_input/1000))
while getopts w:c: option
do
case "${option}"
in
w) thresh_warn=${OPTARG};;
c) thresh_crit=${OPTARG};;
esac
done
if [ $temp -ge $thresh_warn ] && [ $temp -le $thresh_crit ]; then
echo "WARNING - CPU: $temp °C | 'CPU Temperatur'=$temp;$thresh_warn;$thresh_crit"
exit 1
elif [ $temp -ge $thresh_crit ]; then
echo "CRITICAL - CPU: $temp °C | 'CPU Temperatur'=$temp;$thresh_warn;$thresh_crit"
exit 2
elif [ $temp -lt $thresh_warn ]; then
echo "OK - CPU: $temp °C | 'CPU Temperatur'=$temp;$thresh_warn;$thresh_crit"
exit 0
else
echo "UNKNOWN - No Data"
exit 3
fi