With servers going for so cheap these days, you can pick up a Dell r410 fully loaded for little money. I decided to add this to my home lab without any research as to the noise it produced and I did regret it for a week but figured out that by enabling ipmi in the DRAC and installing impi tools I could control it remotely.
Here is a simple script, I came up with a way to json the temperature, pull the numbers into a file, average all of the temperatures and the loop to adjust the fan speed with the temperature.
Modify the IMIHOST, IMIUSER, and IMPIPW to fit your setup and you may need to create the /var/log/tempC/ folder.
#!/bin/bash
# tempC SETTINGS:
# Modify to suit your needs.
IPMIHOST=[enter idrac address]
IPMIUSER=[enter idrac user]
IPMIPW=[enter idrac password]
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
temprat="/var/log/tempC/temprat.json"
while true; do
#create the json file of temps.
sensors -j > /var/log/tempC/temprat.json
#cat information to the file using JQ
cat $temprat | jq '."coretemp-isa-0000"."Core 0"."temp2_input"' > /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0000"."Core 1"."temp3_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0000"."Core 2"."temp4_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0000"."Core 8"."temp10_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0000"."Core 9"."temp11_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0000"."Core 10"."temp12_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 0"."temp2_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 1"."temp3_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 2"."temp4_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 8"."temp10_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 9"."temp11_input"' >> /var/log/tempC/tempC.calc
cat $temprat | jq '."coretemp-isa-0001"."Core 10"."temp12_input"' >> /var/log/tempC/tempC.calc
#tempC is the average temp of all cores.
tempC=$(awk '{ sum += $1 / 12 } END { printf ("%3.0f\n",sum )}' /var/log/tempC/tempC.calc)
#if temp > set fanspeed
echo "Temperature average is:$tempC"
if [[ $tempC -lt 49 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1a
elif [[ $tempC -gt 49 ]] && [[ $tempC -lt 59 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e
elif [[ $tempC -gt 59 && $tempC -lt 69 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1f
elif [[ $tempC -gt 69 ]] && [[ $tempC -lt 72 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x2f
elif [[ $tempC -gt 72 ]] && [[ $tempC -lt 76 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x3e
elif [[ $tempC -gt 79 ]]
then
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x5f
fi
sleep 15;
done
Run the above in a shell to start with, test with the ‘stress’ app by running “stress –cpu 24”. With stress test going, my system doesn’t go above 70 in 10 minutes time and the sound is still bearable. You can adjust the temps on the elif lines as needed and the fan speed is controlled by the last hex in imitool line. Example, 0x1a could be changed to 0x1b or 0x1c which would speed up the fans and so on.
It’s not impressive programming but it works as needed, enjoy!
~The TextBox.Tech team