12.04 Server setup & Temp Monitoring
Posted: September 8th, 2012, 8:55 am
Greetings:
I have been using the guide "Build A Media Server" found on this website to build a Ubuntu12.04 server. I have been having some troubles and would like request help as I go along if possible. With that said I will start on the first issue.
The first problem I am having is with the script for monitoring the cpu temp and autoshutdown. The script is found here http://www.havetheknowhow.com/scripts/CPUTempShutdown.txt . As the text of the script states that the output of "Sensors" is assumed to be -----. If it is different edit the required strings. I understand this and my output is different, But I seem to have something wrong as it always says it's overheat.
Here is the output of "SENSORS" on my machine.
temp1 should be my CPU I believe, a dual core Phenom. I also believe that AMD processors only output 1 temp for multicores.
Here is my CPUTempShutdown.sh file as I have edited it (Note some info as posted here was changed, ie user, email for security reasons.)
I did remove the two ".ge" entries in the "if [ ${newstr} $1 ] and if [ ${newstr} $2 ] strings as I was getting a warning about them when I ran the script. Any help or advice on how to edit the script or fix the problem would be helpful.
Thank you!
I have been using the guide "Build A Media Server" found on this website to build a Ubuntu12.04 server. I have been having some troubles and would like request help as I go along if possible. With that said I will start on the first issue.
The first problem I am having is with the script for monitoring the cpu temp and autoshutdown. The script is found here http://www.havetheknowhow.com/scripts/CPUTempShutdown.txt . As the text of the script states that the output of "Sensors" is assumed to be -----. If it is different edit the required strings. I understand this and my output is different, But I seem to have something wrong as it always says it's overheat.
Here is the output of "SENSORS" on my machine.
Code: Select all
f71889fg-isa-0a00
Adapter: ISA adapter
+3.3V: +3.31 V
in1: +1.07 V (max = +2.04 V)
in2: +1.62 V
in3: +1.21 V
in4: +0.97 V
in5: +1.10 V
in6: +0.98 V
3VSB: +3.31 V
Vbat: +3.12 V
fan1: 3703 RPM
fan2: 1316 RPM
fan3: 1092 RPM
temp1: +39.0°C (high = +255.0°C, hyst = +251.0°C)
(crit = +255.0°C, hyst = +251.0°C) sensor = transistor
temp2: +31.0°C (high = +255.0°C, hyst = +251.0°C)
(crit = +255.0°C, hyst = +251.0°C) sensor = transistor
temp3: +109.0°C (high = +255.0°C, hyst = +253.0°C)
(crit = +255.0°C, hyst = +253.0°C) sensor = thermistor
nouveau-pci-0200
Adapter: PCI adapter
temp1: +48.0°C (high = +100.0°C, crit = +110.0°C)
k10temp-pci-00c3
Adapter: PCI adapter
temp1: +22.8°C (high = +70.0°C)
temp1 should be my CPU I believe, a dual core Phenom. I also believe that AMD processors only output 1 temp for multicores.
Here is my CPUTempShutdown.sh file as I have edited it (Note some info as posted here was changed, ie user, email for security reasons.)
Code: Select all
#!/bin/bash
# PURPOSE: Script to check temperature of CPU cores and report/shutdown if specified temperatures exceeded
#
# AUTHOR: feedback[AT]HaveTheKnowHow[DOT]com
# Expects two arguments:
# 1. Warning temperature
# 2. Critical shutdown temperature
# eg. using ./CPUTempShutdown.sh 30 40
# will warn when temperature of one or more cores hit 30degrees and shutdown when either hits 40degrees.
# NOTES:
# Change the strings ">>/home/htkh" as required
# Substitute string "myemail@myaddress.com" with your own email address in the string which starts "/usr/sbin/ssmtp myemail@myaddress.com"
# Assumes output from sensors command is as follows:
#
# coretemp-isa-0000
# Adapter: ISA adapter
# Core 0: +35.0 C (high = +78.0 C, crit = +100.0 C)
#
# coretemp-isa-0001
# Adapter: ISA adapter
# Core 1: +35.0 C (high = +78.0 C, crit = +100.0 C)
#
# if not then modify the commands str=$(sensors | grep "Core $i:") & newstr=${str:14:2} below accordingly
echo "JOB RUN AT $(date)"
echo "======================================="
echo ''
echo 'CPU Warning Limit set to => '$1
echo 'CPU Shutdown Limit set to => '$2
echo ''
echo ''
sensors
echo ''
echo ''
for i in 0 1
do
str=$(sensors | grep "temp1: $i:")
newstr=${str:14:2}
if [ ${newstr} $1 ]
then
echo '============================' >>/home/xxx/Desktop/CPUWarning.Log
echo $(date) >>/home/xxx/Desktop/CPUWarning.Log
echo '' >>/home/xxx/Desktop/CPUWarning.Log
echo ' WARNING: TEMPERATURE temp1:' $i 'EXCEEDED' $1 '=>' $newstr >>/home/xxx/Desktop/CPUWarning.Log
echo '' >>/home/xxxx/Desktop/CPUWarning.Log
echo '============================' >>/home/xxx/Desktop/CPUWarning.Log
fi
if [ ${newstr} $2 ]
then
echo '============================'
echo ''
echo 'CRITICAL: TEMPERATURE temp1:' $i 'EXCEEDED' $2 '=>' $newstr
echo ''
echo '============================'
/sbin/shutdown -h now
/usr/sbin/ssmtp me@myemail.com </home/xxx/MyScripts/hotcpu.txt
echo 'Email Sent.....'
exit
else
echo ' Temperature temp1: '$i' OK at =>' $newstr
echo ''
fi
done
echo 'CPU Core is within limits'
echo
I did remove the two ".ge" entries in the "if [ ${newstr} $1 ] and if [ ${newstr} $2 ] strings as I was getting a warning about them when I ran the script. Any help or advice on how to edit the script or fix the problem would be helpful.
Thank you!