ipmi-fan-control/README.md

406 lines
10 KiB
Markdown

# IPMI Controller
Advanced web-based fan control for Dell servers with IPMI support. Automatically adjust fan speeds based on temperature readings from IPMI sensors and optional HTTP lm-sensors endpoint.
**Version:** 1.0.0
**Author:** ImpulsiveFPS
**License:** MIT
---
## Features
- 🌡️ **Temperature Monitoring** - Real-time CPU, inlet, exhaust, and PCIe temperature monitoring
- 🌀 **Automatic Fan Control** - Dynamic fan speed adjustment based on customizable temperature curves
- 📊 **Fan Groups** - Group fans together for unified control
- 📈 **Custom Curves** - Create custom fan curves and assign them to specific fan groups
- 🖥️ **HTTP Sensors** - Optional integration with lm-sensors for additional temperature data
- 🎨 **Dark/Light Theme** - Choose your preferred visual style
- 🔒 **Secure** - Built-in authentication and session management
- 🚀 **Auto-Start** - Automatically resumes operation after system restart
---
## Table of Contents
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [IPMI Setup](#ipmi-setup)
- [HTTP Sensors Setup (Optional)](#http-sensors-setup-optional)
- [First Run](#first-run)
- [Configuration](#configuration)
- [Troubleshooting](#troubleshooting)
- [Support](#support)
---
## Prerequisites
### Hardware Requirements
- Dell server with IPMI support (iDRAC)
- Network connectivity to the server's IPMI interface
- A machine to run the IPMI Controller (can be the same server or a separate management host)
### Software Requirements
- Python 3.8+
- `ipmitool` (for IPMI communication)
- Linux-based system (tested on Ubuntu/Debian)
### Installing ipmitool
```bash
# Ubuntu/Debian
sudo apt update
sudo apt install ipmitool
# Verify installation
ipmitool -V
```
---
## Installation
### 1. Clone the Repository
```bash
git clone https://github.com/ImpulsiveFPS/IPMI-Controller.git
cd IPMI-Controller
```
### 2. Install Python Dependencies
```bash
pip install -r requirements.txt
```
Required packages:
- fastapi
- uvicorn
- pydantic
- requests
### 3. Start the Application
```bash
python3 web_server.py
```
The web interface will be available at `http://localhost:8000`
### 4. (Optional) Systemd Service
To run the controller as a system service:
```bash
sudo cp ipmi-controller.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable ipmi-controller
sudo systemctl start ipmi-controller
```
---
## IPMI Setup
### Step 1: Configure iDRAC/IPMI Network Settings
1. Boot into your Dell server's BIOS/F2 setup
2. Navigate to **iDRAC Settings****Network**
3. Configure a static IP address for iDRAC (e.g., `192.168.5.191`)
4. Save and exit
Alternatively, configure via iDRAC web interface:
1. Access iDRAC at its current IP
2. Go to **iDRAC Settings****Network****IPV4 Settings**
3. Set static IP, subnet mask, and gateway
4. Apply changes
### Step 2: Create IPMI User
#### Method 1: Via iDRAC Web Interface (Recommended)
1. Log into iDRAC web interface
2. Go to **iDRAC Settings****User Authentication****Local Users**
3. Click **Add User** or edit an existing user
4. Configure:
- **User Name:** `root` (or your preferred username)
- **Password:** Strong password
- **IPMI LAN Privilege:** Administrator
- **Enable IPMI over LAN:** ✓ Checked
5. Save changes
#### Method 2: Via ipmitool (Local Access Required)
```bash
# List current users
sudo ipmitool user list 1
# Create new user (ID 3)
sudo ipmitool user set name 3 root
sudo ipmitool user set password 3 YOUR_PASSWORD
sudo ipmitool channel setaccess 1 3 callin=on ipmi=on link=on privilege=4
sudo ipmitool user enable 3
# Verify
sudo ipmitool user list 1
```
### Step 3: Enable IPMI over LAN
```bash
# Enable IPMI over LAN
sudo ipmitool lan set 1 ipsrc static
sudo ipmitool lan set 1 ipaddr 192.168.5.191
sudo ipmitool lan set 1 netmask 255.255.255.0
sudo ipmitool lan set 1 defgw ipaddr 192.168.5.1
sudo ipmitool lan set 1 access on
# Verify settings
sudo ipmitool lan print 1
```
### Step 4: Test IPMI Connection
From another machine on the network:
```bash
ipmitool -I lanplus -H 192.168.5.191 -U root -P YOUR_PASSWORD chassis status
```
If successful, you'll see server power status and other information.
---
## HTTP Sensors Setup (Optional)
HTTP sensors allow you to integrate additional temperature readings from lm-sensors running on your Proxmox host or other systems. This provides more granular CPU core temperatures.
### Step 1: Install lm-sensors on Remote Host
```bash
# On Proxmox or target host
sudo apt update
sudo apt install lm-sensors
# Detect sensors
sudo sensors-detect
# Test
sensors
```
### Step 2: Create HTTP Sensor Server Script
Create `sensor-server.py` on the remote host:
```python
#!/usr/bin/env python3
"""Simple HTTP server for lm-sensors data"""
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import subprocess
class SensorHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/sensors':
try:
result = subprocess.run(['sensors', '-j'],
capture_output=True, text=True)
data = json.loads(result.stdout)
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.send_header('Access-Control-Allow-Origin', '*')
self.end_headers()
self.wfile.write(json.dumps(data).encode())
except Exception as e:
self.send_response(500)
self.end_headers()
self.wfile.write(json.dumps({'error': str(e)}).encode())
else:
self.send_response(404)
self.end_headers()
def log_message(self, format, *args):
pass # Suppress logs
if __name__ == '__main__':
server = HTTPServer(('0.0.0.0', 8888), SensorHandler)
print("Sensor server running on port 8888")
server.serve_forever()
```
### Step 3: Run Sensor Server
```bash
python3 sensor-server.py
```
Or create a systemd service:
```ini
# /etc/systemd/system/sensor-server.service
[Unit]
Description=LM Sensors HTTP Server
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /path/to/sensor-server.py
Restart=always
User=root
[Install]
WantedBy=multi-user.target
```
```bash
sudo systemctl enable sensor-server
sudo systemctl start sensor-server
```
### Step 4: Test HTTP Endpoint
```bash
curl http://192.168.5.200:8888/sensors
```
You should see JSON output with sensor readings.
### Step 5: Configure in IPMI Controller
1. During setup wizard (Step 3), check "Enable HTTP Sensor"
2. Enter URL: `http://192.168.5.200:8888/sensors`
3. Click "Test HTTP Sensor" to verify connection
4. Complete setup
---
## First Run
### Initial Setup Wizard
1. **Step 1: Create Admin Account**
- Username: Choose your admin username
- Password: Minimum 6 characters
- Confirm password
2. **Step 2: IPMI Configuration**
- Host/IP: Your iDRAC IP (e.g., `192.168.5.191`)
- Port: Usually `623`
- Username: IPMI username (e.g., `root`)
- Password: IPMI password
- Click "Test Connection" to verify
3. **Step 3: HTTP Sensor (Optional)**
- Enable HTTP Sensor: Check if using lm-sensors
- URL: `http://your-server:8888/sensors`
- Click "Test HTTP Sensor" to verify
4. **Enable Auto Fan Control**
- Check "Enable Auto Fan Control" to start automatic control immediately
- This activates the default "Balanced" fan curve
5. **Complete Setup**
- Click "Complete Setup" to finish
- You'll be logged in automatically
---
## Configuration
### Fan Curves
Fan curves define how fan speed responds to temperature:
1. Go to **Curves** tab
2. Click **+ Add Curve**
3. Configure:
- **Curve Name:** e.g., "Silent", "Performance"
- **Group:** (Optional) Assign to specific fan group
- **Points:** Add temperature → speed mappings
- Example: `30°C → 20%`, `50°C → 50%`, `70°C → 100%`
4. Click **Save Curve**
5. Click **Activate** to apply the curve
### Fan Groups
Groups allow unified control of multiple fans:
1. Go to **Fan Groups** tab
2. Click **+ Create First Group**
3. Enter group name
4. Select fans to include
5. Click **Save Group**
6. Use **Set Speed** to control all fans in group
### Quick Controls
- **Start Auto:** Enable automatic fan control
- **Stop Auto:** Return to manual/BIOS control
- **Manual Speed Slider:** Set all fans to specific speed
- **Identify Fan:** Flash individual fan to 100% for identification
---
## Troubleshooting
### Connection Issues
**"Not connected" status:**
- Verify IPMI IP address is correct
- Check network connectivity: `ping 192.168.5.191`
- Test with ipmitool: `ipmitool -I lanplus -H 192.168.5.191 -U root chassis status`
- Ensure IPMI user has Administrator privileges
- Verify IPMI over LAN is enabled
**"Connection timeout":**
- Check firewall rules on IPMI network
- Verify port 623 is open
- Try increasing timeout in settings
### Fan Control Not Working
**Fans not responding to speed changes:**
- Some Dell servers require manual fan control to be enabled first
- Check IPMI logs for errors
- Verify fan IDs are correct
- Try using individual fan controls to test
**"Manual fan control not supported":**
- Some server models don't support external fan control
- Check Dell documentation for your specific model
- Try updating iDRAC firmware
### HTTP Sensor Issues
**"HTTP Sensor not working":**
- Verify sensor server is running: `curl http://ip:8888/sensors`
- Check firewall on sensor host
- Ensure lm-sensors is properly configured
- Verify URL format includes `http://` prefix
---
## Support
- 🐛 **Report Bugs:** https://github.com/ImpulsiveFPS/IPMI-Controller/issues
- 📁 **GitHub Repo:** https://github.com/ImpulsiveFPS/IPMI-Controller
-**Support on Ko-fi:** https://ko-fi.com/impulsivefps
---
## Acknowledgments
Built with:
- [FastAPI](https://fastapi.tiangolo.com/) - Web framework
- [Heroicons](https://heroicons.com/) - Icons
- [Lucide](https://lucide.dev/) - Additional icons
---
**IPMI Controller v1.0.0 - Built by ImpulsiveFPS**