#!/bin/bash
# Anders Nerheim
# anders@jblinux.net
# 10.09.2002
# version 0.2

# 'cpu' reads the cpu
# 'case' reads the SBr output

if [ "$1" = "cpu" ]; then
TEMP="CPU Temp"
        else if [ "$1" = "case" ]; then
        TEMP="SYS Temp"
                else
                echo "type either 'case' or 'cpu', not $1"
        fi
fi
# all in 1 line.. uhm.. ugly ;)
GETTEMP="`sensors |grep "$TEMP"|gawk '{print $3}' |cut -c 2-3`"


if test $GETTEMP -ge $3; then
echo "LMSENSORS CRITICAL - temp is $GETTEMP celsius"
exit 2
        else if test $GETTEMP -ge $2 ; then
        echo "LMSENSORS - temp is $GETTEMP celsius"
        exit 1
                else if test $GETTEMP -lt $2 ; then
                echo "LMSENSORS OK - temp is $GETTEMP celsius"
                exit 0
                fi
        fi
fi

