Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ----------------------------------------------------------------------------------
- # Script for checking the temperature reported by the ambient temperature sensor,
- # and if deemed too high send the raw IPMI command to enable dynamic fan control.
- # ----------------------------------------------------------------------------------
- # IPMI SETTINGS:
- # Modify to suit your needs.
- # DEFAULT IP: 192.168.0.120
- IPMIHOST=192.168.1.xxx
- IPMIUSER=
- IPMIPW=
- echo $(date) "Checking Tempature Values"
- ipmitool -H $IPMIHOST -U $IPMIUSER -P $IPMIPW -I lanplus sensor reading "FAN 1 RPM" "Ambient Temp"
- # 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=30
- MIDTEMP=25
- LOWSPEED=2280
- MIDSPEED=4440
- # 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)
- FANSPEED=$(ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW sensor reading "FAN 1 RPM" |grep FAN |grep -Po '\d{4}' | tail -1)
- echo $(date) "Current Fan Speed" $FANSPEED
- echo $(date) "Current Ambient Temp" $TEMP
- if [[ $TEMP > $MAXTEMP ]];
- then
- # printf "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)" | systemd-cat -t R710-IPMI-TEMP
- echo $(date) "Warning: Temperature is too high! Activating dynamic fan control! ($TEMP C)"
- ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x01
- elif [[ $TEMP > $MIDTEMP ]]; then
- if [[ $FANSPEED -eq $MIDSPEED ]]; then
- echo "skiping"
- else
- echo $(date) "Temperature is OK little Warm " $TEMP "c"
- echo $(date) "Setting Syttem to Manual fan control"
- ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
- echo $(date) "Boosting Fan Speed"
- echo $(date) "Setting Fans to 4440rpm"
- ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x1e
- fi
- else
- if [[ $FANSPEED -le $LOWSPEED ]]; then
- echo $(date) "Fan at Speed and Temp Skiping"
- else
- echo $(date) "Setting System To Manual Fan Control"
- ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x01 0x00
- echo $(date) "Temperature is OK ($TEMP C)"
- echo $(date) "Setting Fans to 2280rpm"
- ipmitool -I lanplus -H $IPMIHOST -U $IPMIUSER -P $IPMIPW raw 0x30 0x30 0x02 0xff 0x0a
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement