Getting Started
Prerequisites
- Proxmox VE 7.x or 8.x (tested with 8.3.3)
- Python 3.9+
- Root access to the Proxmox host
- LXC containers already created and configured
Installation
Run the install script on the Proxmox host:
curl -sSL https://raw.githubusercontent.com/fabriziosalmi/proxmox-lxc-autoscale/main/install.sh | bashVerify the service is running:
systemctl status lxc_autoscale.serviceExample output:
root@proxmox:~# systemctl status lxc_autoscale.service
● lxc_autoscale.service - LXC AutoScale Daemon
Loaded: loaded (/etc/systemd/system/lxc_autoscale.service; enabled)
Active: active (running) since Mon 2024-08-19 01:38:07 CEST; 7s ago
Main PID: 40462 (python3)
Memory: 9.1M
CGroup: /system.slice/lxc_autoscale.service
└─40462 /usr/bin/python3 /usr/local/bin/lxc_autoscale/lxc_autoscale.pyHow it works
Each polling cycle (default: 300 seconds):
- Collect — CPU and memory usage is read for each running container via host-side cgroup accounting.
- Evaluate — Usage is compared against the container's tier thresholds (or global defaults).
- Scale — If usage exceeds the upper threshold, cores/memory are added. If below the lower threshold, they are reduced.
- Pin — If
cpu_pinningis configured, the container is pinned to the specified CPU cores. - Log — All scaling events are logged (plain text and JSON) and optionally sent as notifications.
Resource measurement
CPU and memory usage are both read from host-side cgroup accounting (cgroup v2 with v1 fallback). This reads the kernel's own resource tracking directly from the Proxmox host without executing commands inside containers.
Benefits:
- Accurate measurements matching the Proxmox web UI
- No dependency on LXCFS
- Minimal overhead (file reads instead of
pct exec) - Correct results on low-core hosts with many containers
- First measurement cycle is non-blocking (no 2-second sleep)
If cgroup accounting is unavailable, the daemon falls back to /proc/stat for CPU (requires LXCFS) and /proc/meminfo via pct exec for memory.
Backends
LXC AutoScale supports two backends for communicating with Proxmox:
| Backend | Config value | How it works | Requirements |
|---|---|---|---|
| CLI (default) | backend: cli | Executes pct commands locally or via SSH | Root access (local) or SSH credentials (remote) |
| REST API | backend: api | Calls the Proxmox REST API via HTTP | pip install proxmoxer, API token |
The CLI backend is the default and requires no additional dependencies. The REST API backend avoids shell access entirely and uses scoped API tokens, which is preferable for security-sensitive deployments.
See Configuration for backend setup details.
Next steps
- Configuration — YAML settings reference
- Tiers — per-container scaling rules
- CPU Core Pinning — Intel Big.LITTLE support
- Security — SSH hardening, secret masking, API tokens
- Docker — run the daemon in a container