#!/bin/ksh (( warn = 91 )) (( crit = 95 )) [[ ! -x `whence sensors` ]] && echo "TEMPERATURE UNKNOWN - install lm_sensors && exit 3 [[ ! -x `whence awk` ]] && echo "TEMPERATURE UNKNOWN - awk executable not found && exit 3 cpu_temp=`sensors | grep ^Tctl: | awk '{print $2}' | sed 's/[^[:digit:]+.]//g'` #hdd_temp=`sensors | grep ^Composite: | awk '{print $2}' | sed 's/[°C]//g' temp=$cpu_temp if [[ -z $temp ]]; then echo "TEMPERATURE UNKNOWN - temp variable empty" exit 3 elif (( temp >= crit )); then echo "TEMPERATURE CRITICAL - $temp C |$temp" exit 2 elif (( temp >= warn )); then echo "TEMPERATURE WARNING - $temp C |$temp" exit 1 elif (( temp < warn )); then echo "TEMPERATURE OK - $temp C |$temp" exit 0 else echo "TEMPERATURE UNKNOWN - $temp |$temp" exit 3 fi # https://www.pcgamer.com/amd-views-ryzen-5000-cpu-temperatures-up-to-95c-as-typical-and-by-design/ # https://superuser.com/questions/1544400/safe-sustained-operating-temperatures-on-cpuryzen9 # https://www.buildcomputers.net/amd-cpu-temperature.html