Easily manage your HP's server fans speeds, anywhere!
See my comment on r/homelab to know the story behind this!
-
When you open it, the page sends a GET request to the Python "Proxy" to get the current speeds of the fans.
-
When you apply the settings, the page connects to iLO's SSH console and executes necessary commands to set the speeds.
-
In about 30 seconds, your server's fans will be set to the selected speed.
- An HP server, obviously.
- iLO hacked with The Fan Hack (v2.77)
- A web server that supports PHP
- Python 3.8+ with
pip
- An HP DL380e G8 server
- iLO 4 Advanced v2.73 (11 February 2020)
- A Proxmox container running Ubuntu 21.10
- Apache 2 & PHP 8.0
- Python 3.9 & pip 20.3.4
The purpose of the following guide is to give an idea on how to install the script. For example, if you want to use NGINX instead of Apache, you can do it, simply instead of running an Apache command, use the suitable alternative for NGINX.
If you already have git
installed, you can clone the repo directly:
git clone https://github.com/alex3025/ilo-fans-controller.git && cd ilo-fans-controller
Otherwise you can download the zip using the top right green button.
If you downloaded the zip, remember to unzip it and
cd
inside the extracted directory.
-
Install
apache2
,php
,libapache2-mod-php
,libssh2-1
andphp-ssh2
:sudo apt-get install apache2 php libapache2-mod-php libssh2-1 php-ssh2
-
Restart Apache:
sudo systemctl restart apache2
-
Open the
ilo-fans-controller.php
file with a text editor and change the variables:// iLO Credentials $ILO_HOST = '192.168.1.69'; $ILO_USERNAME = 'your-ilo-username'; $ILO_PASSWORD = 'your-ilo-password'; // iLO Fans Proxy Address $ILO_FANS_PROXY_HOST = 'http://localhost:8000'; // Number of fans present in your server // (most of the times you don't need to change this) $FANS = 6;
-
Copy the
ilo-fans-controller.php
file to/var/www/html/
:sudo cp ilo-fans-controller.php favicon.ico /var/www/html/
On most linux distributions, Python 3.8+ should™ be already installed.
If not, there are plenty of tutorials/guides on how to install it.
-
Install
pip3
:sudo apt-get install python3-pip
-
Install the required dependencies:
pip3 install -r requirements.txt
-
Configure the python script:
Open the
ilo-fans-proxy.py
file with a text editor and change the variables (like before):# iLO Credentials ILO_HOST = '192.168.1.69' ILO_USERNAME = 'your-ilo-username' ILO_PASSWORD = 'your-ilo-password'
-
Test the FastAPI server:
gunicorn -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker ilo-fans-proxy:app
8000
can be changed to whatever port you want (as long as it's not in use), but don't forget to change it also in the PHP script.If it's working, press
CTRL+C
to terminate the process and continue with the guide. -
Create a service to run the script automatically on startup:
Make a new file
/etc/systemd/system/ilo-fans-proxy.service
and paste the following text in it (remember to change the<placeholders>
):[Unit] Description=Gunicorn instance to serve iLO Fans Proxy After=network.target [Service] User=<user> Group=www-data WorkingDirectory=<directory of the python script> ExecStart=gunicorn -b 0.0.0.0:<port> -k uvicorn.workers.UvicornWorker ilo-fans-proxy:app [Install] WantedBy=multi-user.target
Then enable and start the service:
sudo systemctl enable ilo-fans-proxy.service sudo systemctl start ilo-fans-proxy.service
-
If you are going to expose the web server to the public (or you installed the script on an existing public Apache installation), make sure to add some sort of authentication (like Basic Authentication) to avoid people making your server take off at 3 AM.
-
You can set the fans speeds programmatically sending a POST request to the PHP script:
# Example (using curl) curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "fan-0=50&fan-3=25..." http://<server ip>/ilo-fans-controller.php
If the operation was successful, the response's status code is
200
.
Every other code means that there was an error.