diff --git a/check_temp.sh b/check_temp.sh index 5f779a1..d6f7868 100755 --- a/check_temp.sh +++ b/check_temp.sh @@ -33,17 +33,24 @@ # # ############################################################################### -VERSION="Version 0.8" +VERSION="Version 0.93" AUTHOR="(c) 2011 Jack-Benny Persson (jack-benny@cyberinfo.se)" # Sensor program -SENSORPROG=/usr/bin/sensors +SENSORPROG=$(whereis -b -B /{bin,sbin,usr,etc} /{bin,sbin,usr,etc}/* -f sensors | awk '{print $2}') -# Exit codes -STATE_OK=0 -STATE_WARNING=1 -STATE_CRITICAL=2 -STATE_UNKNOWN=3 +# Ryan's note: utils.sh is installed with nagios-plugins in with the plugins +# Check if utils.sh exists. This lets you use check_domain in a testing environment +# or outside of Nagios. +if [ -e "$PROGPATH/utils.sh" ]; then + . "$PROGPATH/utils.sh" +else + STATE_OK=0 + STATE_WARNING=1 + STATE_CRITICAL=2 + STATE_UNKNOWN=3 +# STATE_DEPENDENT=4 (Commented because it's unused.) +fi shopt -s extglob @@ -52,15 +59,15 @@ shopt -s extglob # Print version information print_version() { - printf "\n\n$0 - $VERSION\n" + echo "$0 - $VERSION" } #Print help information print_help() { print_version - printf "$AUTHOR\n" - printf "Monitor temperature with the use of sensors\n" + echo "$AUTHOR" + echo "Monitor temperature with the use of sensors" /bin/cat <