A lightweight REST API wrapper for the go-ipmi library that exposes all IPMI functionality over HTTP with minimal dependencies and maximum simplicity.
- Exposes IPMI functionality through a RESTful API
- Connection pooling for efficient IPMI communication
- Header-based authentication for flexible credential management
- Standardized JSON responses
- Health check endpoints
- Docker support for easy deployment
- Interactive API documentation with Scalar
GET /openapi.json- OpenAPI specification for the serviceGET /docs- Scalar API reference, based on theopenapi.jsonspecification
GET /health- Basic health checkGET /health/ready- Readiness probeGET /health/live- Liveness probe
GET /api/v1/ipmi/system/info- Get device ID and system infoGET /api/v1/ipmi/system/guid- Get system GUIDGET /api/v1/ipmi/system/boot-options- Get boot device options (Not implemented)POST /api/v1/ipmi/system/boot-device- Set boot device (Partially implemented)
GET /api/v1/ipmi/power/status- Get power statusPOST /api/v1/ipmi/power/on- Power onPOST /api/v1/ipmi/power/off- Power offPOST /api/v1/ipmi/power/cycle- Power cyclePOST /api/v1/ipmi/power/reset- Hard reset
GET /api/v1/ipmi/sensors- Get all sensorsGET /api/v1/ipmi/sdr- Get sensor data records (Not implemented)GET /api/v1/ipmi/sel- Get system event logPOST /api/v1/ipmi/sel/clear- Clear event log
GET /api/v1/ipmi/chassis/status- Get chassis statusPOST /api/v1/ipmi/chassis/identify- Chassis identify LED (Not implemented)GET /api/v1/ipmi/chassis/bootdev- Get boot devicePOST /api/v1/ipmi/chassis/bootdev/set- Set boot device (Partially implemented)
GET /api/v1/ipmi/fru- Get all FRU dataGET /api/v1/ipmi/fru/{fru-id}- Get specific FRU (Not implemented)
GET /api/v1/ipmi/users- List usersPOST /api/v1/ipmi/users/create- Create userGET /api/v1/ipmi/users/{user-id}- Get userPUT /api/v1/ipmi/users/{user-id}- Update userDELETE /api/v1/ipmi/users/{user-id}- Delete user
GET /api/v1/ipmi/lan- Get LAN configurationPOST /api/v1/ipmi/lan- Set LAN configuration (Partially implemented)
The API supports two methods for providing IPMI credentials:
Set these environment variables to provide default credentials for all requests:
DEFAULT_IPMI_HOST=<default-host>
DEFAULT_IPMI_PORT=623 # Optional, defaults to 623
DEFAULT_IPMI_USERNAME=<default-username>
DEFAULT_IPMI_PASSWORD=<default-password>Provide these headers in your requests to override default credentials:
X-IPMI-Host: <target-host>
X-IPMI-Port: <target-port> # Optional, defaults to 623
X-IPMI-Username: <username>
X-IPMI-Password: <password>
The following environment variables can be used to configure the API:
# API Server Configuration
IPMI_API_PORT=8080 # API server port
IPMI_API_HOST=0.0.0.0 # API server bind address
IPMI_TIMEOUT=30s # IPMI command timeout
IPMI_POOL_SIZE=100 # Max concurrent connections
LOG_LEVEL=info # Logging level
# Default IPMI Authentication (Optional)
DEFAULT_IPMI_HOST= # Default IPMI host for all requests
DEFAULT_IPMI_PORT=623 # Default IPMI port
DEFAULT_IPMI_USERNAME= # Default IPMI username
DEFAULT_IPMI_PASSWORD= # Default IPMI password# Clone the repository
git clone https://github.com/mdshack/ipmi-api.git
cd ipmi-api
# Install dependencies
go mod tidy
# Run the application
go run main.go# Pull the Docker image
docker pull mdshack/ipmi-api:latest
# Run the container
docker run -d \
--name ipmi-api \
-p 8080:8080 \
-e DEFAULT_IPMI_HOST=your.ipmi.host \
-e DEFAULT_IPMI_USERNAME=admin \
-e DEFAULT_IPMI_PASSWORD=secret \
mdshack/ipmi-api:latestInteractive API documentation is available at /docs endpoint when the server is running. This documentation is powered by Scalar, a modern and lightweight alternative to Swagger UI.
curl -H "X-IPMI-Host: 192.168.1.100" \
-H "X-IPMI-Username: admin" \
-H "X-IPMI-Password: password" \
http://localhost:8080/api/v1/ipmi/power/statuscurl -X POST \
-H "X-IPMI-Host: 192.168.1.100" \
-H "X-IPMI-Username: admin" \
-H "X-IPMI-Password: password" \
http://localhost:8080/api/v1/ipmi/power/on- Go 1.21 or later
- Docker (for containerization)
# Build the binary
go build -o ipmi-api main.go
# Run tests
go test ./...This project is licensed under the Apache-2.0 License - see the LICENSE file for details.