Our script using impitool to control fans is back to silence
@Novacom Could you kindly share it? I've found a bunch online but none really seem satisfying.
Our script using impitool to control fans is back to silence
#!/bin/bash
# Fancontrol v1.1 2022-09-15 15:42
# Define variables
MAX_FAN=90
MIN_FAN=20
HIGH_TEMP=37
LOW_TEMP=35
SPEED_STEP=10
IDRAC_IP=10.0.0.1
IPMI_USER=fancontrol
IPMI_PASSWORD=yoursupercomplexpassword
# Define Functions
ENABLE_FAN ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1
}
GET_TEMP ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD sensor reading "Exhaust Temp"|sed 's/[^0-9]//g'
}
SET_FAN ()
{
ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x02 0xff $FAN_SETTING > /dev/null 2>&1
}
# File to save the last fan speed
[ -f fan_speed.last ] || echo $MIN_FAN > fan_speed.last
FAN_SPEED=$(<fan_speed.last)
#-----------------------------------------------------------------------------------------
CURRENT_TEMP=$(GET_TEMP) # get the current temperature
if (($CURRENT_TEMP > $HIGH_TEMP)) ; then
FAN_SPEED=$(expr $FAN_SPEED + $SPEED_STEP)
if (($FAN_SPEED > $MAX_FAN)) ; then
FAN_SPEED=$MAX_FAN
fi
fi
if (($CURRENT_TEMP < $LOW_TEMP)) ; then
FAN_SPEED=$(expr $FAN_SPEED - $SPEED_STEP)
if (($FAN_SPEED < $MIN_FAN)) ; then
FAN_SPEED=$MIN_FAN
fi
fi
FAN_SETTING=$(printf "0x"'%x\n' $FAN_SPEED)
ENABLE_FAN
SET_FAN
logger -t FanControl "Current Temperature" $CURRENT_TEMP"C" "Fans at" $FAN_SPEED"%"
echo $FAN_SPEED > fan_speed.last
exit 0
This is great! Thanks for sharing.@no-usernames-left hope this one can help you :
Background : We use several Dell R730XD that uses non-Dell nvme cards with Samsung Pro drives in a ZFS pool, mirror + stripe scheme... This non standard setup automatically sets the fan at 15000+ rpm. Quite annoying. Since v 8.x in Proxmox, the script was spitting out the warning, source of this thread.
This script gets executed by cron at 5 min intervals
You need to create a user in IDRAC for impi access
Temperature are in celsius
Fan speeds are in %
The script tries to set the fan speed to obtain the right temperature at exhaust by raising or lowering fan %.
Has been quite stable since last year - your mileage may varyno warranty !
Bash:#!/bin/bash # Fancontrol v1.1 2022-09-15 15:42 # Define variables MAX_FAN=90 MIN_FAN=20 HIGH_TEMP=37 LOW_TEMP=35 SPEED_STEP=10 IDRAC_IP=10.0.0.1 IPMI_USER=fancontrol IPMI_PASSWORD=yoursupercomplexpassword # Define Functions ENABLE_FAN () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1 } GET_TEMP () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD sensor reading "Exhaust Temp"|sed 's/[^0-9]//g' } SET_FAN () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x02 0xff $FAN_SETTING > /dev/null 2>&1 } # File to save the last fan speed [ -f fan_speed.last ] || echo $MIN_FAN > fan_speed.last FAN_SPEED=$(<fan_speed.last) #----------------------------------------------------------------------------------------- CURRENT_TEMP=$(GET_TEMP) # get the current temperature if (($CURRENT_TEMP > $HIGH_TEMP)) ; then FAN_SPEED=$(expr $FAN_SPEED + $SPEED_STEP) if (($FAN_SPEED > $MAX_FAN)) ; then FAN_SPEED=$MAX_FAN fi fi if (($CURRENT_TEMP < $LOW_TEMP)) ; then FAN_SPEED=$(expr $FAN_SPEED - $SPEED_STEP) if (($FAN_SPEED < $MIN_FAN)) ; then FAN_SPEED=$MIN_FAN fi fi FAN_SETTING=$(printf "0x"'%x\n' $FAN_SPEED) ENABLE_FAN SET_FAN logger -t FanControl "Current Temperature" $CURRENT_TEMP"C" "Fans at" $FAN_SPEED"%" echo $FAN_SPEED > fan_speed.last exit 0
Happy new year
Francis
Thank you for sharing this, Francis! I'm worried that updating the fan every 5 min is going to risk the CPU being cooked for 4 minutes before the fans are updated, and by performing some load testing with@no-usernames-left hope this one can help you :
stress I realized the CPU can go from 40 to 80 degrees in 15 seconds when the CPU load spikes (such as a backup starting).-I open). This might even mean that you don't need to expose the IPMI interface to the network at all. This is important in the event that the interface is on a network not entirely under your control, since iDRAC 6 (what my machines have) is hopelessly outdated and full of vulnerabilities.You are a GOD amongst Us.It is fixed in Debian Experimental, you may try to download the package from there and install if by hand via:
Code:cd /tmp wget http://ftp.debian.org/debian/pool/main/i/ipmitool/ipmitool_1.8.19-5_amd64.deb dpkg -i ipmitool_1.8.19-5_amd64.deb
I created an account just to say thanks for this solution. Works flawlessly and my ears can once again rest.Based on @LnxBil workaroud and @acdoussan link, this is what have worked for me :
Code:wget -O /usr/share/misc/enterprise-numbers.txt https://www.iana.org/assignments/enterprise-numbers.txt
No reboot needed - Our script using impitool to control fans is back to silence
got same problemlink is dead, 1.8.19-6 doesn't work either, and I've tried downloading this file from http://www.iana.org/assignments/enterprise-numbers.txt, I still get the following
Code:root@sm1:/tmp# ipmitool user list IPMI command failed: Invalid data field in request
anyone know of any other fixes?
Hi!@no-usernames-left hope this one can help you :
Background : We use several Dell R730XD that uses non-Dell nvme cards with Samsung Pro drives in a ZFS pool, mirror + stripe scheme... This non standard setup automatically sets the fan at 15000+ rpm. Quite annoying. Since v 8.x in Proxmox, the script was spitting out the warning, source of this thread.
This script gets executed by cron at 5 min intervals
You need to create a user in IDRAC for impi access
Temperature are in celsius
Fan speeds are in %
The script tries to set the fan speed to obtain the right temperature at exhaust by raising or lowering fan %.
Has been quite stable since last year - your mileage may varyno warranty !
Bash:#!/bin/bash # Fancontrol v1.1 2022-09-15 15:42 # Define variables MAX_FAN=90 MIN_FAN=20 HIGH_TEMP=37 LOW_TEMP=35 SPEED_STEP=10 IDRAC_IP=10.0.0.1 IPMI_USER=fancontrol IPMI_PASSWORD=yoursupercomplexpassword # Define Functions ENABLE_FAN () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1 } GET_TEMP () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD sensor reading "Exhaust Temp"|sed 's/[^0-9]//g' } SET_FAN () { ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x02 0xff $FAN_SETTING > /dev/null 2>&1 } # File to save the last fan speed [ -f fan_speed.last ] || echo $MIN_FAN > fan_speed.last FAN_SPEED=$(<fan_speed.last) #----------------------------------------------------------------------------------------- CURRENT_TEMP=$(GET_TEMP) # get the current temperature if (($CURRENT_TEMP > $HIGH_TEMP)) ; then FAN_SPEED=$(expr $FAN_SPEED + $SPEED_STEP) if (($FAN_SPEED > $MAX_FAN)) ; then FAN_SPEED=$MAX_FAN fi fi if (($CURRENT_TEMP < $LOW_TEMP)) ; then FAN_SPEED=$(expr $FAN_SPEED - $SPEED_STEP) if (($FAN_SPEED < $MIN_FAN)) ; then FAN_SPEED=$MIN_FAN fi fi FAN_SETTING=$(printf "0x"'%x\n' $FAN_SPEED) ENABLE_FAN SET_FAN logger -t FanControl "Current Temperature" $CURRENT_TEMP"C" "Fans at" $FAN_SPEED"%" echo $FAN_SPEED > fan_speed.last exit 0
Happy new year
Francis
There is no > or < in shell, you need to use the comparators -lt and -gt. Please refer to the test manpage.Hi!
Here is what the script returns on y end. Any cues??
root@router0:/tmp# ./ipmi_fan.sh
Error: Unable to establish IPMI v2 / RMCP+ session
./ipmi_fan.sh: line 45:) > 37: syntax error: operand expected (error token is "> 37")
./ipmi_fan.sh: line 52:) < 35: syntax error: operand expected (error token is "< 35")
Package in Debian Experimental changed, just download the file manually, as shown in here.i seem to get
--2024-04-05 12:25:08-- http://ftp.debian.org/debian/pool/main/i/ipmitool/ipmitool_1.8.19-6_amd64.deb
Resolving ftp.debian.org (ftp.debian.org)... 199.232.26.132, 2a04:4e42:43::644
Connecting to ftp.debian.org (ftp.debian.org)|199.232.26.132|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-04-05 12:25:08 ERROR 404: Not Found.
when i try to download ipmitool on my server could anyone help with this
i had downloaded that but any command i used with ipmitool just stated that it was not a commandPackage in Debian Experimental changed, just download the file manually, as shown in here.
okay ... then use the now (as of today) newer version 1.8.19-7 from trixie:i had downloaded that but any command i used with ipmitool just stated that it was not a command
after trying the command this is all i gotokay ... then use the now (as of today) newer version 1.8.19-7 from trixie:
http://ftp.debian.org/debian/pool/main/i/ipmitool/ipmitool_1.8.19-7_amd64.deb
EDIT: I added the instructions to my original post.
you forgot to install the package, you just downloaded itafter trying the command this is all i got
root@ibm3650:~# wget http://ftp.debian.org/debian/pool/main/i/ipmitool/ipmitool_1.8.19-7_amd64.deb
--2024-04-05 13:35:05-- http://ftp.debian.org/debian/pool/main/i/ipmitool/ipmitool_1.8.19-7_amd64.deb
Resolving ftp.debian.org (ftp.debian.org)... 199.232.26.132, 2a04:4e42:43::644
Connecting to ftp.debian.org (ftp.debian.org)|199.232.26.132|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1972336 (1.9M) [application/vnd.debian.binary-package]
Saving to: ‘ipmitool_1.8.19-7_amd64.deb’
ipmitool_1.8.19-7_amd 100%[=======================>] 1.88M 11.6MB/s in 0.2s
2024-04-05 13:35:05 (11.6 MB/s) - ‘ipmitool_1.8.19-7_amd64.deb’ saved [1972336/1972336]
root@ibm3650:~# ipmitool
-bash: ipmitool: command not found
i am sorry but how to i install the package?you forgot to install the package, you just downloaded it
ahh it worked thanks for all the help this is the first week of me having a server so i am still getting stuff ready
apparently there is no such file or directory when i enter the command ipmitool or any other ipmitool commandahh it worked thanks for all the help this is the first week of me having a server so i am still getting stuff ready
We use essential cookies to make this site work, and optional cookies to enhance your experience.