#!/bin/cshset MaxCPUTemp = 75set NumCPUs = `sysctl -n kern.smp.cpus`set CurrentCPU = 0while ( $CurrentCPU < $NumCPUs ) set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'` echo "CPU $CurrentCPU temp: $CPUTemp" if ( $CPUTemp >= $MaxCPUTemp ) then exit 1 endif @ CurrentCPU = $CurrentCPU + 1endexit 0
#!/bin/cshset MaxCPUTemp = 60set status = 0set NumCPUs = `sysctl -n kern.smp.cpus`set CurrentCPU = 0while ( $CurrentCPU < $NumCPUs ) set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'` echo "CPU $CurrentCPU temp: $CPUTemp" if ( $CPUTemp >= $MaxCPUTemp ) then set status = 1 exit 1 endif @ CurrentCPU = $CurrentCPU + 1endexit 0if ( $Status == 0 ) then echo "System Health: OKendifexit $Status
You could write a script that to check the CPU temp and add it to Monit as described in the Monit HowTo (look for the CheckIPMI.sh script).CheckCPUTemp.shCode: [Select]#!/bin/cshset MaxCPUTemp = 75set NumCPUs = `sysctl -n kern.smp.cpus`set CurrentCPU = 0while ( $CurrentCPU < $NumCPUs ) set CPUTemp = `sysctl dev.cpu.$CurrentCPU.temperature | awk '{print $2}' | awk -F. '{print $1}'` echo "CPU $CurrentCPU temp: $CPUTemp" if ( $CPUTemp >= $MaxCPUTemp ) then exit 1 endif @ CurrentCPU = $CurrentCPU + 1endexit 0