How to control Dell server fanspeeds with ipmitool
Link: https://wiki.joeplaa.com/en/tutorials/how-to-control-dell-server-fanspeeds-with-ipmitool
Introduction
I'm running a homelab partly as a hobby, but also to support our business needs, especially the software development part. My current setup consist of three servers, one HP and two Dell servers. The HP server is running perfectly fine when considering its temperatures and fanspees. The fans are throttled down pretty aggressively, so I don't really have too much of an issue with noise. It will speed up and make a racket when TeamCity is doing its thing, but that is shortlived.
The Dells however are troublesome. I have a T320 with 8 harddisks running TrueNAS. The disks obviously produce heat and the single fan in the tower doesn't generate enough airflow. Or better said, because the air shroud is missing, the air is not properly routed along the disk and through the CPU heat sink. The CPU will run into the 50°C region (when idling) when the ambient temperature is around 30°C (we're experiencing a heat wave).
The other Dell, a R320, is just loud. The little fans have to spin at an insane rate to keep the CPU cool. On top of that, I flashed the RAID card to passthrough mode for ZFS. The server doesn't get any disk temperature readings and thus preventatively speeds up the fans (this doesn't seem to apply to the T320).
The real solution would be to have a dedicated, air-conditioned (or at least well ventilated) room. But alas, we don't have that luxury. Currently the servers are in a little hallway next to the office. This little room will heat up quickly with three servers buzzing away, so the doors cannot be closed permanently.
A temporary "fix", well it isn't really a fix, because they are still very loud, is to slow down the fans manually using ipmitool
commands. The downside obviously is that temperatures will go up quickly. Luckily brezlord made a script to fix that, thanks man!.
The script
I modified it a little to fit my specific usecase:
- Changed the "dynamic" temperature from 35 to 45°C
- Added additional speed settings
- Use the CPU instead of inlet (ambient) temperature to control the speeds
- Added additional speed increments
#!/bin/bash
#
# https://github.com/brezlord/iDRAC7_fan_control
# A simple script to control fan speeds on Dell generation 12 PowerEdge servers.
# If the inlet temperature is above 45deg C enable iDRAC dynamic control and exit program.
# If inlet temp is below 45deg C set fan control to manual and set fan speed to predetermined value.
# The tower servers T320, T420 & T620 inlet temperature sensor is after the HDDs so temperature will
# be higher than the ambient temperature.
# Variables
IDRAC_IP="IP address of iDRAC"
IDRAC_USER="user"
IDRAC_PASSWORD="password"
# Fan speed in %
SPEED0="0x00"
SPEED5="0x05"
SPEED10="0x0a"
SPEED15="0x0f"
SPEED20="0x14"
SPEED25="0x19"
SPEED30="0x1e"
SPEED35="0x23"
SPEED40="0x28"
SPEED45="0x2D"
SPEED50="0x32"
TEMP_THRESHOLD="45" # iDRAC dynamic control enable threshold
#TEMP_SENSOR="04h" # Inlet Temp
#TEMP_SENSOR="01h" # Exhaust Temp
TEMP_SENSOR="0Eh" # CPU 1 Temp
#TEMP_SENSOR="0Fh" # CPU 2 Temp
# Get system date & time.
DATE=$(date +%d-%m-%Y\ %H:%M:%S)
echo "Date $DATE"
# Get temperature from iDARC.
T=$(ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD sdr type temperature | grep $TEMP_SENSOR | cut -d"|" -f5 | cut -d" " -f2)
echo "--> iDRAC IP Address: $IDRAC_IP"
echo "--> Current CPU Temp: $T"
# If CPU ~~ambient~~ temperature is above 45deg C enable dynamic control and exit, if below set manual control.
if [[ $T > $TEMP_THRESHOLD ]]
then
echo "--> Temperature is above 45deg C"
echo "--> Enabled dynamic fan control"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x01 0x01
exit 1
else
echo "--> Temperature is below 45deg C"
echo "--> Disabled dynamic fan control"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x01 0x00
fi
# Set fan speed dependant on CPU ~~ambient~~ temperature if CPU ~~inlet~~ temperature is below 45deg C.
# If CPU ~~inlet~~ temperature between 0 and 19deg C then set fans to 15%.
if [ "$T" -ge 0 ] && [ "$T" -le 19 ]
then
echo "--> Setting fan speed to 15%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED15
# If inlet temperature between 20 and 24deg C then set fans to 20%
elif [ "$T" -ge 20 ] && [ "$T" -le 24 ]
then
echo "--> Setting fan speed to 20%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED20
# If inlet temperature between 25 and 29deg C then set fans to 25%
elif [ "$T" -ge 25 ] && [ "$T" -le 29 ]
then
echo "--> Setting fan speed to 25%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED25
# If inlet temperature between 30 and 34deg C then set fans to 30%
elif [ "$T" -ge 30 ] && [ "$T" -le 34 ]
then
echo "--> Setting fan speed to 30%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED30
# If inlet temperature between 35 and 40deg C then set fans to 35%
elif [ "$T" -ge 35 ] && [ "$T" -le 39 ]
then
echo "--> Setting fan speed to 35%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED35
# If inlet temperature between 40 and 45deg C then set fans to 40%
elif [ "$T" -ge 40 ] && [ "$T" -le 45 ]
then
echo "--> Setting fan speed to 40%"
ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED40
fi
Implementation
pfSense
-
Create a folder
/root/fan_control
-
The Bash executable in pfSense is located in
usr/local/bin/bash
, so make sure this is specified in the top of the script:#!/usr/local/bin/bash ...
-
Copy the script to the folder
-
Make script executable:
chmod +x /root/fan_control/fan_control.sh
-
Add iDRAC credentials in script
-
Run the script to test
-
Create a cron job with
crontab -e
and add line:* * * * * /usr/local/bin/bash /root/fan_control/fan_control.sh >/dev/null 2>&1
TrueNAS
I followed breznet's guide.
- Create a dataset
fan_control
- Copy the script to the dataset
- Make script executable:
chmod +x /mnt/store1/fan_control/fan_control.sh
- Add iDRAC credentials in script
- Run the script to test
- Create a cron job in TrueNAS GUI running every minute
No Comments