(Post-Firmware Unlock – Silence of the Fans Guide: GitHub)
After a lot of trial and error with various other people’s scripts, ChatGPT, my own feeble brain and skills, I figured out how to automate fan control on an HP DL380 Gen9 using a dedicated Linux VM. This system runs two scripts: If it is in ALL CAPS it is PLACEHOLDER replace it with your own info.
- Fan Control Script: Adjusts iLO fan speeds.
- Monitoring Script: Logs temperatures and sends alerts.
Both run automatically on boot and restart on failure.
1. Prerequisites
Before you start, ensure you have:
- ✅ A Linux VM (Ubuntu recommended)
- ✅ SSH access to iLO
- ✅
expect
installed for automating SSH interactions:
sudo apt update && sudo apt install expect -y
- ✅ Python installed for monitoring script:
sudo apt install python3 -y
2. Fan Control Script
This script connects to iLO, adjusts fan speeds, and logs output.
2.1. Create the script
sudo tee /home/USER/scripts/quietFansDL380G9.sh > /dev/null <<EOF
#!/usr/bin/expect -f
log_file -a /home/USER/scripts/fanlog.txt
set timeout 20
# iLO Credentials
set ILO_HOST "ILO_IP"
set ILO_USER "ILO_USERNAME"
set ILO_PASS "ILO_PASSWORD"
# SSH into iLO and send fan control commands
spawn ssh -tt -o KexAlgorithms=+diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 \
-o HostKeyAlgorithms=ssh-rsa,ssh-dss -o StrictHostKeyChecking=no \
\$ILO_USER@\$ILO_HOST
expect "password:"
send "\$ILO_PASS\r"
expect "hpiLO->"
# Apply fan settings
send "fan p 1 min 20\r"
send "fan p 2 min 20\r"
send "fan p 3 min 20\r"
send "fan p 4 min 20\r"
send "fan p 5 min 20\r"
send "fan p 6 min 20\r"
# Disable temperature-based fan controls
send "fan t 32 off\r"
send "fan t 45 off\r"
send "fan t 31 off\r"
send "fan t 41 off\r"
send "fan t 38 off\r"
send "fan t 37 off\r"
send "fan t 29 off\r"
send "fan t 34 off\r"
send "fan t 35 off\r"
# Exit iLO session
send "exit\r"
expect eof
# Log success message
exec echo "[exec date] Fan and sensor configurations applied successfully." >> /home/USER/scripts/fanlog.txt
EOF
2.2. Make the script executable
sudo chmod +x /home/USER/scripts/quietFansDL380G9.sh
3. Monitoring Script
This script checks iLO temperatures and sends email alerts if they exceed thresholds.
3.1. Create the script
sudo tee /home/USER/scripts/fan_monitor.py > /dev/null <<EOF
import smtplib
import subprocess
import time
# Email configuration
EMAIL_ADDRESS = "YOUR_EMAIL"
EMAIL_PASSWORD = "YOUR_EMAIL_PASSWORD"
SMTP_SERVER = "smtp.YOUR_MAIL_PROVIDER.com"
SMTP_PORT = 587
TO_EMAIL = "YOUR_EMAIL"
# iLO Credentials
ILO_HOST = "ILO_IP"
ILO_USER = "ILO_USERNAME"
ILO_PASSWORD = "ILO_PASSWORD"
# Temperature thresholds
SENSOR_THRESHOLDS = {
"Inlet Ambient": 126,
"CPU 1": 158,
"CPU 2": 158,
"P1 DIMM 1-6": 113,
"P1 DIMM 7-12": 113,
"P2 DIMM 1-6": 113,
"P2 DIMM 7-12": 113,
"HD Max": 140,
"Chipset": 221
}
# Email notification function
def send_email(subject, body):
try:
with smtplib.SMTP(SMTP_SERVER, SMTP_PORT) as server:
server.starttls()
server.login(EMAIL_ADDRESS, EMAIL_PASSWORD)
message = f"Subject: {subject}\n\n{body}"
server.sendmail(EMAIL_ADDRESS, TO_EMAIL, message)
except Exception as e:
print(f"Failed to send email: {e}")
# Function to fetch iLO temperature data
def get_ilo_temperatures():
command = f"echo show /system1/thermal | sshpass -p {ILO_PASSWORD} ssh -o StrictHostKeyChecking=no {ILO_USER}@{ILO_HOST}"
result = subprocess.run(command, shell=True, capture_output=True, text=True)
return result.stdout if result.returncode == 0 else ""
# Function to parse temperatures
def parse_temperatures(output):
temperatures = {}
for line in output.splitlines():
if "Temperature" in line:
parts = line.split()
sensor_name = parts[0]
temperature = int(parts[-1].replace("C", ""))
temperatures[sensor_name] = temperature
return temperatures
# Monitor temperatures
def monitor_temperatures():
ilo_data = get_ilo_temperatures()
if not ilo_data:
return
temperatures = parse_temperatures(ilo_data)
for sensor, current_temp in temperatures.items():
threshold = SENSOR_THRESHOLDS.get(sensor, float("inf"))
if current_temp >= threshold:
send_email(f"Temperature Alert: {sensor}", f"Sensor '{sensor}' at {current_temp}°C.")
while True:
monitor_temperatures()
time.sleep(300) # Check every 5 minutes
EOF
3.2. Make the script executable
sudo chmod +x /home/USER/scripts/fan_monitor.py
4. Creating the Systemd Services
4.1. Fan Control Service
sudo tee /etc/systemd/system/quietFansDL380G9.service > /dev/null <<EOF
[Unit]
Description=Quiet Fans DL380 G9
After=network.target
[Service]
ExecStart=/usr/bin/expect -f /home/USER/scripts/quietFansDL380G9.sh
Restart=on-failure
RestartSec=5
User=USER
WorkingDirectory=/home/USER/scripts
StandardOutput=append:/home/USER/scripts/fanlog.txt
StandardError=append:/home/USER/scripts/fanlog.txt
[Install]
WantedBy=multi-user.target
EOF
4.2. Monitoring Service
sudo tee /etc/systemd/system/fan_monitor.service > /dev/null <<EOF
[Unit]
Description=Monitor DL380 Fan Temperatures
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/USER/scripts/fan_monitor.py
Restart=always
RestartSec=5
User=USER
WorkingDirectory=/home/USER/scripts
StandardOutput=append:/home/USER/scripts/fan_monitor.log
StandardError=append:/home/USER/scripts/fan_monitor.log
[Install]
WantedBy=multi-user.target
EOF
5. Enabling & Testing
sudo systemctl daemon-reload
sudo systemctl enable quietFansDL380G9.service fan_monitor.service
sudo systemctl start quietFansDL380G9.service fan_monitor.service
sudo systemctl status quietFansDL380G9.service fan_monitor.service
tail -f /home/USER/scripts/fanlog.txt /home/USER/scripts/fan_monitor.log
✅ Automated fan control & temperature monitoring complete! 🚀
🚨 Disclaimer: 🚨
This script may cause excessive quietness in your server rack. If you suddenly hear birds chirping, people talking, or your own thoughts for the first time in years, do not be alarmed—this is normal.
💨 Warning:
Side effects may include whisper-quiet fans, lower electricity bills, and confused data center employees wondering why your rack isn’t doubling as a jet engine anymore.
🔥 Legal Stuff:
This script is provided as-is, with no guarantees, refunds, or emotional support if your server develops abandonment issues from not screaming 24/7.
🛠️ Troubleshooting Tip:
If your fans are still too loud, consider upgrading your hardware, moving to a data center in Antarctica, or using earplugs.
💻 For Science!
No servers were harmed (physically) in the making of this script. Emotional damage, however, is still under investigation.
⚡ Power Tip:
Running this script won’t overclock your CPUs, make you more attractive, or increase your credit score… but it might save your sanity.
💀 Risk Acknowledgment:
By using this script, you accept full responsibility for any unexpected silence, awkward tech support calls, or smug satisfaction from finally taming your HP DL380 Gen9.
📜 Final Note:
If this script breaks your server, turn it off and on again. If that doesn’t work, pretend it was always like that and blame cosmic rays.