Dell R720XD
I found this bash script a couple years ago (don't know the author), it has some errors in it and was not working for me. I have fixed those errors and this is what I have. The IPMIHOST, IPMIUSER, and IPMIPW have been changed to protect the innocent...
The script checks the inlet vs exhaust temps and adjusts the fans up or down depending on the temp difference. It also sets a base speed depending on the ambient room, inlet, temp.
#!/bin/bash
# Login Creds
IPMIHOST=10.10.10.110
IPMIUSER=user
IPMIPW=SUPERsecret
# Fan Settings
# Change to fit your needs
FANSPEED=60
LOWESTSPEED=5
MAXSPEED=90
# Temperatures
inlet=0
exhaust=0
tempdiff=0
# The maximum difference between inlet and exhaust temp before fans ramp up (In Celsius)
maxtempdiff=10
# Enable Manual Fan Speed
ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
# This variable sends an IPMI command to get the temperature, and outputs it as two digits.
# Do not edit unless you know what you're doing.
inlet=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature | grep 'Inlet Temp' | grep degrees | grep -Po '\d{2}' | tail -1)
exhaust=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature | grep 'Exhaust Temp' | grep degrees | grep -Po '\d{2}' | tail -1)
tempdiff=$(($exhaust - $inlet))
echo ---------------
echo Real Readings
echo ---------------
echo Real inlet temp: $inlet
echo Real exhaust temp: $exhaust
echo Temperature difference: $tempdiff
if [[ $inlet -le 20 ]]; then
FANSPEED=$LOWESTSPEED
elif [[ $inlet -le 25 ]]; then
FANSPEED=$(($LOWESTSPEED + 3))
elif [[ $inlet -le 30 ]]; then
FANSPEED=$(($LOWESTSPEED + 7))
elif [[ $inlet -le 40 ]]; then
FANSPEED=$(($LOWESTSPEED + 15))
elif [[ $inlet -le 50 ]]; then
FANSPEED=$(($LOWESTSPEED + 35))
fi
echo "Base fanspeed by temp is: $FANSPEED"
inletaddspeed=0
echo Difference between inlet and exhaust: $tempdiff
echo Max allowed difference: $maxtempdiff
inletdiff=$(($tempdiff - $maxtempdiff))
if [[ $inletdiff -ge 0 ]]; then
inletaddspeed=$inletdiff
fi
echo Add to fanspeed: $inletaddspeed
echo InletaddSpeed: $inletaddspeed
# Set Overrides
override=0
if [[ $exhaust -ge 70 ]]; then
FANSPEED=50
override=1
elif [[ $exhaust -ge 72 ]]; then
FANSPEED=60
override=1
elif [[ $exhaust -ge 80 ]]; then
FANSPEED=90
override=1
fi
if [[ $override -eq 1 ]]; then
echo ----------------------
echo OVERRIDE HIGH TEMP
echo ----------------------
echo Exhaust high temp: $exhaust
echo setting fanspeed to $FANSPEED
fi
echo ----------------
echo Setting Fanspeed
echo ----------------
echo Inlet Temp base fanspeed: $FANSPEED
echo Inlet/Exhaust diff fanspeed: $inletaddspeed
if [[ $inletaddspeed -le 0 ]]; then
inletaddspeed=0
FANSPEED=$(($FANSPEED + $inletaddspeed))
if [[ $FANSPEED -ge $MAXSPEED ]]; then
FANSPEED=$MAXSPEED
elif [[ $FANSPEED -le $LOWESTSPEED ]]; then
FANSPEED=$LOWESTSPEED
fi
fi