Skip to main content

Synchronize Proxmox Virtual Environment (PVE) information to a NetBox instance

Project description

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 can also set the NB_CLUSTER_ID env variable in order to indicate the ID of the cluster that will be used in NetBox.

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
replicated Virtual Machine Replicated Boolean
ha Virtual Machine Failover 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, Sys.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

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

netbox_pve_sync-0.2.2.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

netbox_pve_sync-0.2.2-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file netbox_pve_sync-0.2.2.tar.gz.

File metadata

  • Download URL: netbox_pve_sync-0.2.2.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for netbox_pve_sync-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ee826fe8f85f4eb7d231a1b083a308817932a3540fc65f55309a43d9e9296881
MD5 7e87a0bede3076cdf5a9dad3bbead15b
BLAKE2b-256 c6edf19b52436c124ea788a1b40253dbea83292dfc4016cd49013210d319d05d

See more details on using hashes here.

File details

Details for the file netbox_pve_sync-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_pve_sync-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3e37158a69bcbe55cbeed5445e0c39e78c52649b41b66947f02153462bb44f
MD5 23430baabf23e6dec993c54fc3dbb917
BLAKE2b-256 32e5404989c4ee9658e81b7829b2521ce92933bdd8db630e12ea32db7132d2bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page