Proxmox VM & container inventory CLI
Project description
pxinv
A fast CLI for inventorying and managing VMs and containers on your Proxmox homelab.
$ pxinv list
VMID NAME NODE TYPE STATUS CPU RAM DISK UPTIME TAGS
──────────────────────────────────────────────────────────────────────────────────────────────────────
100 homeassistant pve-01 VM running 5.2% 1.0GB/4.0GB 10.0GB/32.0GB 3d homelab
101 pihole pve-01 CT running 0.8% 128.0MB/512.0MB 1.0GB/8.0GB 14d dns
200 talos-cp-01 pve-02 VM stopped — —/8.0GB —/64.0GB — k8s
3 resource(s) — 2 running, 1 stopped
Installation
pip install pxinv
Or install from source:
git clone https://github.com/thetechiejourney/pxinv
cd pxinv
pip install -e .
Authentication
pxinv uses Proxmox API tokens (recommended over username/password).
Create a token in Proxmox:
- Go to Datacenter → Permissions → API Tokens
- Add a token for your user (e.g.
root@pam, token name:pxinv) - Copy the token value — it's only shown once
Required permissions: VM.Audit and Sys.Audit on / (or per-node).
Configuration
Credentials can be provided in three ways (in order of precedence):
1. CLI flags
pxinv --host 192.168.1.10 --token-name pxinv --token-value <secret> list
2. Environment variables
export PXINV_HOST=192.168.1.10
export PXINV_TOKEN_NAME=pxinv
export PXINV_TOKEN_VALUE=<secret>
export PXINV_VERIFY_SSL=false # optional, for self-signed certs
pxinv list
3. Config file
~/.config/pxinv/config.yaml:
host: 192.168.1.10
user: root@pam
token_name: pxinv
token_value: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
verify_ssl: false
Commands
pxinv list
List all VMs and containers.
# All guests
pxinv list
# Filter by node
pxinv list --node pve-01
# Only running containers
pxinv list --type ct --status running
# Filter by tag
pxinv list --tags k8s
pxinv list --tags homelab --status running
# JSON output (pipe to jq, etc.)
pxinv list --output json | jq '.[] | select(.cpu_usage > 50)'
# YAML output
pxinv list --output yaml
pxinv watch
Live-refresh the VM/container list directly in the terminal. No flickering — powered by rich.Live. Press Ctrl+C to exit.
# Refresh every 5 seconds (default)
pxinv watch
# Custom interval
pxinv watch --interval 10
# Combinable with all list filters
pxinv watch --status running
pxinv watch --tags k8s --interval 3
pxinv watch --node pve-01
The panel header shows the refresh interval and the timestamp of the last update.
pxinv summary
Show cluster-wide resource totals and node status.
pxinv summary
pxinv summary --output json
pxinv start <vmid>
Start a VM or container by VMID.
pxinv start 100
# Wait until the VM is fully running before returning
pxinv start 100 --wait
# Custom timeout (default: 60s)
pxinv start 100 --wait --timeout 120
pxinv stop <vmid>
Gracefully shut down a VM or container by VMID.
pxinv stop 100
# Wait until the VM is fully stopped before returning
pxinv stop 100 --wait
pxinv ansible-inventory
Export the inventory in Ansible dynamic inventory JSON format. Hosts are automatically grouped by status (running, stopped) and by Proxmox tag (tag_homelab, tag_k8s, etc.).
# Basic inventory (no IPs)
pxinv ansible-inventory
# Fetch IPs via QEMU guest agent (requires qemu-guest-agent installed in VMs)
pxinv ansible-inventory --with-ips
# Only include running guests
pxinv ansible-inventory --running-only
# Use directly with ansible
ansible -i <(pxinv ansible-inventory) all -m ping
# Target a specific group
ansible -i <(pxinv ansible-inventory) tag_homelab -m ping
ansible -i <(pxinv ansible-inventory) running -m setup
Example output:
{
"all": {
"hosts": ["homeassistant", "pihole"],
"children": ["running", "stopped", "tag_homelab", "tag_dns"]
},
"running": { "hosts": ["homeassistant", "pihole"] },
"stopped": { "hosts": [] },
"tag_homelab": { "hosts": ["homeassistant"] },
"tag_dns": { "hosts": ["pihole"] },
"_meta": {
"hostvars": {
"homeassistant": {
"ansible_host": "192.168.1.100",
"proxmox_vmid": 100,
"proxmox_node": "pve-01",
"proxmox_type": "vm",
"proxmox_status": "running",
"proxmox_tags": ["homelab"]
}
}
}
}
ansible_hostis only populated when using--with-ipsand the VM hasqemu-guest-agentrunning.
Tags
Proxmox supports tagging VMs and containers via the UI (VM → Options → Tags). pxinv shows tags as a column in pxinv list and lets you filter by them:
pxinv list --tags homelab
pxinv list --tags k8s --status running
Tag matching is case-insensitive. Multiple tags per VM are supported — filtering matches any VM that contains the specified tag.
Self-signed certificates
If your Proxmox uses the default self-signed cert, disable verification:
pxinv --no-verify-ssl list
# or
export PXINV_VERIFY_SSL=false
Contributing
PRs welcome. To set up a dev environment:
git clone https://github.com/thetechiejourney/pxinv
cd pxinv
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pxinv-0.3.0.tar.gz.
File metadata
- Download URL: pxinv-0.3.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0342c69d084f07c92cdf8f725251be4ad11bfd82bfb3621b3c5ab1ed8381c033
|
|
| MD5 |
08435aa946a5727e12f83b7615ed763e
|
|
| BLAKE2b-256 |
b869f9fd5a8b38d66baadd32c03ded2279e7955029673810274d88ad9083d47f
|
File details
Details for the file pxinv-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pxinv-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cbf625be2d29a050a41a507f85e86ec748ed43afdc7e81ac6421b87c7807c6a
|
|
| MD5 |
171e2a4f305a986be3921429225774d0
|
|
| BLAKE2b-256 |
ad892664c64628e5d9ec82a08884628fd4120cc981ea7b3e4a5feadd3e94ab47
|