iLO Fans Controller
r/homelab to know the reason why I made this!
See my comment onHow it works
-
To get the current speeds of the fans, the PHP script will send a GET request to the iLO Fans Proxy, which will return a JSON array with the current readings.
-
When you click the "Apply settings" button, the PHP script will send the necessary commands to manage the speed to the iLO SSH console.
-
The fans speeds of the server are updated.
Installation
Requirements:
- iLO with the fan hack;
- A web server with PHP 7.4;
- Python 3.9 with
pip
;
For this example, Ubuntu 21.04 with Apache 2 and PHP 7.4 is used.
To get started, clone this repository and "cd" into it.
iLO Fans Controller:
-
Install PHP 7.4 build tools:
$ sudo apt-get install php-pear php7.4-dev
-
Install the SSH2 extension:
$ sudo pecl install ssh2-alpha
-
Add the extension to the
/etc/php/7.4/apache2/php.ini
file:... ;extension=pdo_pgsql ;extension=pdo_sqlite ;extension=pgsql ;extension=shmop + extension=ssh2.so ; The MIBS data available in the PHP distribution must be installed. ...
-
Restart Apache:
$ sudo systemctl restart apache2
-
Copy the
ilo-fans-controller.php
file to/var/www/html/
:$ sudo cp ilo-fans-controller.php /var/www/html/
iLO Fans Proxy:
-
Install python requirements:
$ pip3 install -r requirements.txt
-
Run the python script:
$ gunicorn -w 1 -b 0.0.0.0:8000 -k uvicorn.workers.UvicornWorker main:app
8000
can be changed to whatever port you want, only remember to change it on the php script and check if it's not used by another service.You can also create a service to run the script automatically on startup...
Create a new file
/etc/systemd/system/ilo-fans-proxy.service
and write the following in it (making sure to change the placeholders):[Unit] Description=Gunicorn instance to serve iLO Fans Proxy After=network.target [Service] User=<user> Group=www-data WorkingDirectory=<parent directory of the python script> ExecStart=gunicorn -w 1 -b 0.0.0.0:<port> -k uvicorn.workers.UvicornWorker main:app [Install] WantedBy=multi-user.target
Then enable and start it:
$ sudo systemctl enable ilo-fans-proxy.service
$ sudo systemctl start ilo-fans-proxy.service