sibi78 Posted March 3, 2019 Share Posted March 3, 2019 Hi All, I have a Dell R710, and I found this script (https://github.com/NoLooseEnds/Scripts/blob/master/R710-IPMI-TEMP/R710-IPMITemp.sh) online to automatically control fan speed via IPMI. I was trying to set this up on my server with a custom script. I had a couple of questions regarding this: 1) I originally created my own shell script based off the above example in /root of my UNRAID server. The script was working well, but I had to stop the array, and restart the server. When the system rebooted, I noticed that my script stored in the path /root was deleted. This was surprising to me as I had expected the root filesystem to be persistent. Is this not true? If it is, where is a recommended place to store this script? 2) I had manually created a crontab entry for the root user to the run the above script periodically. That crontab entry also didn't persist across reboots. I was wondering what's the recommended way (plugin) for doing the crontab entry? Thanks for your help! Quote Link to comment
Squid Posted March 3, 2019 Share Posted March 3, 2019 5 minutes ago, sibi78 said: This was surprising to me as I had expected the root filesystem to be persistent. Is this not true? If it is, where is a recommended place to store this script? Anything not stored in /mnt/diskX (or /mnt/user/) or /boot is not persistent. 5 minutes ago, sibi78 said: I was wondering what's the recommended way (plugin) for doing the crontab entry? User scripts plugin would be the easiest method Alternatives would be entering the commands in via the "go" file. Quote Link to comment
sibi78 Posted March 4, 2019 Author Share Posted March 4, 2019 @Squid, thanks for the reply, and for the "user scripts" plugin - it's very useful. I've created the same script via the user scripts plugin, and everything works well. I'm looking for a way to capture the output of my script to a log file (preferably in the plugin folder or in /tmp/) to check if everything is running properly. I couldn't find a way when I searched the forum. Could you shed some light into how I'd do this? Thanks! Quote Link to comment
Alphahelix Posted March 4, 2019 Share Posted March 4, 2019 @sibi78 I am trying to do the same, yet I did not get it to as expected. I hope it is ok to ask to see your script. /Alphahelix Quote Link to comment
sibi78 Posted March 4, 2019 Author Share Posted March 4, 2019 (edited) @Alphahelix, sure. With due credit to the original link (https://github.com/NoLooseEnds/Scripts/blob/master/R710-IPMI-TEMP/R710-IPMITemp.sh ), I made some slight tweaks. Note I can confirm this is working on my dell poweredge R710, your mileage might vary depending on the type of server. It's nothing fancy, but I'm starting out simple to see how it works - I mainly wanted to reduce the fan speeds from ~6K RPM with automatic fan control to something less noisy. The IPMI* variables must be filled with the right values for your server. Hope this helps. # TEMPERATURE # Change this to the temperature in celcius you are comfortable with. # If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control MAXTEMP=33 TEMP_STEP1=28 TEMP_STEP2=30 TEMP_STEP3=32 # 28 -> 20% # 30 -> 30% # 32 -> 40% # 33 -> Automatic control # This variable sends a IPMI command to get the temperature, and outputs it as two digits. # Do not edit unless you know what you do. TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1) echo $TEMP if [ $TEMP -ge $MAXTEMP ]; then echo " $TEMP is > $MAXTEMP. Switching to automatic fan control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01 elif [ $TEMP -le $TEMP_STEP1 ]; then echo " $TEMP is < $TEMP_STEP1. Switching to manual 20% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x14 elif [ $TEMP -le $TEMP_STEP2 ]; then echo " $TEMP is < $TEMP_STEP2. Switching to manual 30% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e elif [ $TEMP -le $TEMP_STEP3 ]; then echo " $TEMP is < $TEMP_STEP3. Switching to manual 40% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x28 fi Edited March 4, 2019 by sibi78 Quote Link to comment
TheScrantonStrangler Posted August 30, 2019 Share Posted August 30, 2019 (edited) On 3/3/2019 at 11:47 PM, sibi78 said: *snip* So I'm trying to get this working on my server and I'm having a few issues. #!/bin/bash # TEMPERATURE # Change this to the temperature in celcius you are comfortable with. # If the temperature goes above the set degrees it will send raw IPMI command to enable dynamic fan control MAXTEMP=33 TEMP_STEP1=28 TEMP_STEP2=30 TEMP_STEP3=32 IPMIHOST=192.168.1.120 IPMIUSER=myUserName IPMIPW=myPassword # 28 -> 20% # 30 -> 30% # 32 -> 40% # 33 -> Automatic control # This variable sends a IPMI command to get the temperature, and outputs it as two digits. # Do not edit unless you know what you do. TEMP=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sdr type temperature |grep Ambient |grep degrees |grep -Po '\d{2}' | tail -1) echo $TEMP if [ $TEMP -ge $MAXTEMP ]; then echo " $TEMP is > $MAXTEMP. Switching to automatic fan control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01 elif [ $TEMP -le $TEMP_STEP1 ]; then echo " $TEMP is < $TEMP_STEP1. Switching to manual 20% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x14 elif [ $TEMP -le $TEMP_STEP2 ]; then echo " $TEMP is < $TEMP_STEP2. Switching to manual 30% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e elif [ $TEMP -le $TEMP_STEP3 ]; then echo " $TEMP is < $TEMP_STEP3. Switching to manual 40% control " ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00 ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x28 fi I've added variables for IP address, username, and pwd. When I run the script I get the following: Script location: /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script Note that closing this window will abort the execution of this script /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 20: ipmitool: command not found /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 24: [: -ge: unary operator expected /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 27: [: -le: unary operator expected /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 31: [: -le: unary operator expected /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script: line 35: [: -le: unary operator expected I found this plugin for IMPI and installed it. It says in the post that IPMI Tool is no longer included in the plugin, but when I go to install the package it throws a bunch of errors at me. Is there something I am missing/not understanding? I'm trying to increase the WAF of my server in our apartment and it's not going too well haha. EDIT So I had a brain wave and decided to check NerdTools, and there it was! Now I get this error: Script location: /tmp/user.scripts/tmpScripts/IPMI_Fan_Control/script Note that closing this window will abort the execution of this script 27 27 is < 28. Switching to manual 20% control Unable to send RAW command (channel=0x0 netfn=0x30 lun=0x0 cmd=0x30 rsp=0xcc): Invalid data field in request Any suggestions? EDIT2 Turns out that is a normal message! It works!! Now for another nooby question: How often do I need to run this? Edited August 30, 2019 by TheScrantonStrangler Quote Link to comment
whoisdecoy Posted April 8, 2020 Share Posted April 8, 2020 Not sure how often to run this. If you expect to be maxing out your server; quite often (30sec-1min). I am going to run mine every 5 min and see how it goes. Also if you are the following issue. enable the following on iDRAC (R710/R510 for me) in iDRAC settings > Network/Security > IPMI Settings > Enable IPMI Over LAN Error: Unable to establish IPMI v2 / RMCP+ session Quote Link to comment
bpalhares Posted June 6, 2022 Share Posted June 6, 2022 Hi I'm trying to run the script via CA User Scripts. I have checked and I have Enable IPMI Over Lan activated (DELL R515). I have installed Nerd Tools and IPMI. If I go to the terminal I can execute all the IPMI commands and control the fans speed. If I try to execute the script via CA User Scripts, it doesn't work, returning Error: Unable to establish IPMI v2 / RMCP+ session /tmp/user.scripts/tmpScripts/fan_ipmi_control/script: line 26: [: -ge: unary operator expected /tmp/user.scripts/tmpScripts/fan_ipmi_control/script: line 29: [: -le: unary operator expected /tmp/user.scripts/tmpScripts/fan_ipmi_control/script: line 33: [: -le: unary operator expected /tmp/user.scripts/tmpScripts/fan_ipmi_control/script: line 37: [: -le: unary operator expected Script Finished Jun 06, 2022 15:38.21 Any Idea? Quote Link to comment
bsession1014 Posted March 6, 2023 Share Posted March 6, 2023 for the dell r720 change "Ambient" to "Inlet Temp" if you want ambient air temp or "Temp" if you want the cpu temp. Quote Link to comment
bsession1014 Posted March 6, 2023 Share Posted March 6, 2023 bpalhares run (ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sensor list |grep Temp) to get the list of what your temp sensors are called and replace "Ambient" with whatever sensor you want to run your script off of. then set a cron job for how often you want the script to run. this is set schedule to custom and in the bar that pops up put in the code of numbers need ( this may help https://www.hostinger.com/tutorials/cron-job ). Quote Link to comment
bsession1014 Posted August 10, 2023 Share Posted August 10, 2023 i am using this script and it works but in my dell r720 both cpus just come up as "temp" and the script is grabbing the lower of the 2 "temp" sensors. is there an edit to take the highest of the 2 sensors "temp"? sorry I've tried looking around and a few edits but cant figure it out any help would really be appreciated, thank you. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.