https://github.com/creekorful/netbox-pve-sync
Synchronize Proxmox Virtual Environment (PVE) information to a NetBox instance (mirror)
https://github.com/creekorful/netbox-pve-sync
netbox proxmox python sync
Last synced: about 2 months ago
JSON representation
Synchronize Proxmox Virtual Environment (PVE) information to a NetBox instance (mirror)
- Host: GitHub
- URL: https://github.com/creekorful/netbox-pve-sync
- Owner: creekorful
- License: gpl-3.0
- Created: 2025-02-23T18:16:39.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-02-24T18:49:56.000Z (about 2 months ago)
- Last Synced: 2025-02-24T19:36:53.520Z (about 2 months ago)
- Topics: netbox, proxmox, python, sync
- Language: Python
- Homepage: https://pypi.org/project/netbox-pve-sync/
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# netbox-pve-sync
Synchronize Proxmox Virtual Environment (PVE) information to a NetBox instance.
This allows automatic tracking of Virtual Machines, disks, IP addresses/prefixes, MAC addresses, VLANs, ...## How does it work?
This script work by pulling VMs information from the PVE API and create/update/delete resources on NetBox.
## Installation
This package is available on PyPi. You can install it using pip.
```
$ pip install netbox-pve-sync
```## Configuration
### On NetBox
You'll need to create a dedicated user (ex: netbox-pve-sync) on your NetBox instance and then create a write API
token.The following env variables will need to be set:
- **NB_API_URL**: The URL to your NetBox instance. (ex: https://netbox.example.org)
- **NB_API_TOKEN**: The token created previously. (ex: f74cb99cf552b7005fd1a616b53efba2ce0c9656)You'll also need to perform a minimal configuration on NetBox:
- Create the physical nodes hosting the cluster. (The name should match the one on Proxmox, so that the script can
correctly link the VMs to the physical host)
- Create the cluster.
- Add the following Custom Fields:| Name | Object types | Label | Type |
|-----------|-----------------|-----------|---------|
| autostart | Virtual Machine | Autostart | Boolean |
| backup | Virtual Disk | Backup | Boolean |
| dns_name | Prefix | DNS Name | Text |### On the PVE API
You'll need to create a dedicated user (ex: netsync) on your PVE cluster and then create an API token.
The user needs to have access to the VM.Monitor, Pool.Audit, VM.Audit permissions.
The following env variables will need to be set:
- **PVE_API_HOST**: The DNS/IP to your PVE instance. (ex: 10.10.0.10)
- **PVE_API_USER**: The username of the account created previously. (ex: netsync@pve)
- **PVE_API_TOKEN**: The name of the API token created previously. (ex: test-token)
- **PVE_API_SECRET**: The API token created previously (ex: 4d46dc0a-6363-47a2-98df-d5cdfefa33d2)## Executing the script
You can then execute the script using the following command:
```
PVE_API_HOST=xx PVE_API_USER=xx PVE_API_TOKEN=xx PVE_API_SECRET=xx NB_API_URL=xx NB_API_TOKEN=xx python3 -m netbox_pve_sync
```