Skip to content
Permalink
Browse files

Add error handling to thermal sensor check

  • Loading branch information...
NEMS Linux
NEMS Linux committed Apr 7, 2019
1 parent 77ec2da commit aa8a40b58110088d44e8c4bcaf546c2feb0f6c9b
Showing with 11 additions and 1 deletion.
  1. +11 −1 data/1.5/nagios/plugins/check_rpi_temperature
@@ -7,6 +7,11 @@
#
# Dependency: awk bc
# licence: GPL
#
# Revised by Robbie Ferguson for NEMS Linux

platform=$(/usr/local/share/nems/nems-scripts/info.sh platform)

if [ -z "$1" ] ; then
echo "UNKNOWN - missing warning temperature"
exit 3
@@ -29,8 +34,13 @@ if ! ( command -v bc >/dev/null ) ; then
exit 3
fi

if (( $platform == 20 )); then
echo "UNKNOWN - Virtual Appliance cannot provide thermal data"
exit 3
fi

if ! [[ -f /sys/class/thermal/thermal_zone0/temp ]] ; then
echo "UNKNOWN - /sys/class/thermal/thermal_zone0/temp: No such file"
echo "UNKNOWN - Thermal sensor doesn't exist"
exit 3
fi

0 comments on commit aa8a40b

Please sign in to comment.
You can’t perform that action at this time.