This repository contains scripts for synchronizing VMs and LXCs data from Proxmox VE to NetBox Virtual Machines.
proxmox_export.py
generates a JSON file proxmox_vms.json
containing Proxmox VE VMs and LXCs.
netbox_import.py proxmox_vms.json
imports data from the JSON file into NetBox. Existing Virtual Machines in NetBox will be updated.
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows, use: venv\Scripts\activate
Install required packages:
pip install -r requirements.txt
Requires a API key with read permissions to /vms and /nodes paths.
- Create new account under Datacenter -> Permissions -> Users -> Add.
- Select "Proxmox VE authentication" as realm
- Create new API token for user.
- Assign role "PVEAuditor" for API key and user/group under paths "/nodes" and "/vms" under Datacenter -> Permissions -> Add.
Requires write permissions to create and update data. Create a new user, assign correct permissions and add new API key.
Create a .env
file from the example:
cp example.env .env
Edit the .env
file with your configuration values.
Ensure that you created a Device in NetBox for the Proxmox node.
Run the proxmox_export.py
script:
python ./proxmox_export.py
Check the output file proxmox_vms.json
.
Run the netbox_import.py
script:
python ./netbox_import.py proxmox_vms.json