Automatic Fan Control for PowerEdge R710

There are various guides online for controlling the fan speed of you R710 through IPMI. And I used them and others to make my own script.

For me, I was not able to get IPMI working through an Ubuntu VM so I made a CentOS 7 container the sole purpose of which is to update the fan speed of the R710.

First I created a new directory mkdir /scripts and added a new file nano r710-fan-control.sh

inside of that new file I wrote of the script:

#!/bin/bash

IPMIHOST=192.168.1.114
IPMIUSER=root
IPMIPW=calvin
IPMIEK=0000000000000000000000000000000000000000

TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK sdr type temperature |gr$

ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00

if [[ $TEMP = 25 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 2 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x02
elif [[ $TEMP = 27 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 2 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x02
elif [[ $TEMP = 28 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 3 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x3
elif [[ $TEMP = 29 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 3 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x3
elif [[ $TEMP = 30 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 3 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x3
elif [[ $TEMP = 31 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 4 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x4
elif [[ $TEMP = 32 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 4 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x4
elif [[ $TEMP = 33 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 4 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x4
elif [[ $TEMP = 34 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 5 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x5
elif [[ $TEMP = 35 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 5 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x5
elif [[ $TEMP = 36 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 10 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0xA
elif [[ $TEMP = 37 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 10 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0xA
elif [[ $TEMP = 38 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 15 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0xF
elif [[ $TEMP = 39 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 15 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0xF
elif [[ $TEMP > 40 ]]; then
	printf "Temp is ($TEMP C) Setting Fans to 75 percent"
	ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -y $IPMIEK raw 0x30 0x30 0x02 0xff 0x4B
fi

It's a bit overkill but I like having a bit more of a fine control over my fans.

After that I made it executable with chmos +x r710-fan-control.sh

Then I needed to install it as a cron job. I wasn't sure how to do that with the default editor for centos so I changed the default editor to nano with the commands:
yum -y install nano
cat <>/etc/profile.d/nano.sh
export VISUAL="nano"
export EDITOR="nano"
EOF
then i entered crontab -e to make a new command

I entered */5 * * * * /scripts/r710-fan-control.sh >> /scripts/temp.log 2>>&1 so that i could have the command run every 5 minutes and have the results of the script put into a log file in the same folder the script is in.

That about sums it up. Now i have a fully working fan speed adjuster for my R710. And if it turns out that it's not regulating effectively then i can just go in an edit the script when i need to.

Edit:

I also made a separate script that timestamps the entries and then writes them to the log

the script was created at nano timestamps.sh and the scripts is:

!/bin/bash

 while read x; do
		echo -n `date +%d/%m/%Y\ %H:%M:%S`;
		echo -n " ";
		echo $x;
 done

Just make that executable and edit the cron job to be */5 * * * * /scripts/r710-fan-control.sh | /scripts/timestamp.sh >> /scripts/temp.log 2>&1