Coder Social home page Coder Social logo

netdevopsbr / netbox-proxbox Goto Github PK

View Code? Open in Web Editor NEW
297.0 297.0 40.0 5.07 MB

Netbox Plugin for integration between Proxmox and Netbox

License: Apache License 2.0

Python 57.59% Dockerfile 0.45% HTML 18.74% Shell 0.03% SCSS 16.82% JavaScript 1.84% TypeScript 4.36% CSS 0.16%
api best-effort community community-driven containers docs fastapi hypervisor kvm netbox netbox-plugin opensource proxmox proxmoxer pynetbox python qemu virtual-machine virtualization

netbox-proxbox's People

Contributors

ananiasfilho avatar chankster avatar codebleu avatar dependabot[bot] avatar devopstales avatar emersonfelipesp avatar gskill75 avatar klaernie avatar langlais115 avatar lug-gh avatar mrbe4r avatar rwl-dittrich avatar skydiablo avatar ugenk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netbox-proxbox's Issues

Server Error

Good afternoon, with the help of heavenly power, I managed to install the plugin. But it fails to start. When clicking on the Proxmox VM/СT link, an error occurs:
Server Error
The complete exception is provided below:
<class 'django.template.exceptions.TemplateDoesNotExist'>

base.html

Python version: 3.8.10
NetBox version: 3.0.3


And another question, does the plugin support work with api on https or not?

ModuleNotFoundError: No module named 'proxmoxer' | On python3 manage.py migrate

(venv) root@netbox:/opt/netbox/netbox# python3 manage.py migrate
Traceback (most recent call last):
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 95, in wrapped
saved_locale = translation.get_language()
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/translation/init.py", line 210, in get_language
return _trans.get_language()
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/translation/init.py", line 65, in getattr
if settings.USE_I18N:
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 87, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 183, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 644, in
raise e
File "/opt/netbox/netbox/netbox/settings.py", line 637, in
plugin = importlib.import_module(plugin_name)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/init.py", line 40, in
from . import proxbox_api
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/init.py", line 1, in
from . import (
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 2, in
from .plugins_config import (
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/plugins_config.py", line 2, in
from proxmoxer import ProxmoxAPI
ModuleNotFoundError: No module named 'proxmoxer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/core/management/base.py", line 427, in run_from_argv
connections.close_all()
File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/utils.py", line 212, in close_all
for alias in self:
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/connection.py", line 73, in iter
return iter(self.settings)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/functional.py", line 49, in get
res = instance.dict[self.name] = self.func(instance)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/connection.py", line 45, in settings
self._settings = self.configure_settings(self._settings)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/db/utils.py", line 148, in configure_settings
databases = super().configure_settings(databases)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/utils/connection.py", line 50, in configure_settings
settings = getattr(django_settings, self.settings_name)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 87, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/opt/netbox/venv/lib/python3.9/site-packages/django/conf/init.py", line 183, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 644, in
raise e
File "/opt/netbox/netbox/netbox/settings.py", line 637, in
plugin = importlib.import_module(plugin_name)
File "/usr/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 790, in exec_module
File "", line 228, in _call_with_frames_removed
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/init.py", line 40, in
from . import proxbox_api
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/init.py", line 1, in
from . import (
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 2, in
from .plugins_config import (
File "/opt/netbox/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/plugins_config.py", line 2, in
from proxmoxer import ProxmoxAPI
ModuleNotFoundError: No module named 'proxmoxer'
(venv) root@netbox:/opt/netbox/netbox#

Full Update class 'KeyError'

On a fresh install of Netbox, I am having this error as soon as I try to do a full update:

Server Error

There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'KeyError'>

'errors'

Python version: 3.8.10
NetBox version: 3.0.0

If further assistance is required, please post to the NetBox mailing list.
Home Page

Does not work on netbox-3.1.10

netbox-proxbox 0.0.3 does not work on netbox 3.1.10. See the following stack track from python3 manage.py migrate

python3 manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/init.py", line 395, in execute
django.setup()
File "/opt/netbox/venv/lib/python3.8/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/opt/netbox/venv/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
File "/opt/netbox/netbox/extras/plugins/init.py", line 61, in ready
template_extensions = import_object(f"{self.module}.{self.template_extensions}")
File "/opt/netbox/netbox/extras/plugins/utils.py", line 31, in import_object
spec.loader.exec_module(module)
AttributeError: 'zipimporter' object has no attribute 'exec_module'

Plugin isn't recognized by netbox

Hi there!

After spending the entire yesterday on trying to get it to work, I'm now at a point where I consider the installation I was using as perfect, yet netbox still will not recognize the plugin. Another plugin installed the same way does work, so there must be something amiss that I cannot put my finger on or lack the debugging knowledge for.

Could you please take a look at the docker container I built:

The configuration is not contained in the docker image, but injected later on kubernetes level, as I use https://github.com/bootc/netbox-chart to deploy my image.

This is the relevant part of values.yaml, that is then used to deploy the configuration to kubernetes:
image
I only blanked out the token values, everything else is harmless to share. I could also upload a censored version of the entire file, but I think it would be way too far to hope that you'd setup an entire kubernetes cluster just to test that.

What did I test that makes me sure that the installation is as it should be?

  1. starting netbox itself works - when a plugin cannot be found at all it would not start but rather crash with an ImportError exception.
  2. Entering the container on kubernetes I can execute a python interpreter and tell it to run the module, where I do not get any error except the expected no module named netbox_proxbox.__main__, which is expected, since netbox-proxbox does not have one. But and compilation errors or missing dependencies would have been found by then.

How am I sure, that netbox does have the plugin loaded?

  1. The sidebar entry is missing
  2. Executing the migrations nothing pops up that isn't there in a stock netbox
  3. the django admin UI doesn't list the plugin as installed.

This is what I tried inside the container to verify that everything seems okay:

kandre@mainframe(pts/11) ~/k8s/internal/netbox % kubectl -n netbox exec netbox-5f585c4995-96jmx -it netbox -- sh                                                                                            [130]:26479
/opt/netbox/netbox $ source /opt/netbox/venv/bin/activate
(venv) /opt/netbox/netbox $ /opt/netbox/launch-netbox.sh
⚙️ Applying configuration from /etc/unit/nginx-unit.json
2022/05/20 16:43:23 [warn] 33#33 Unit is running unprivileged, then it cannot use arbitrary user and group.
2022/05/20 16:43:23 [alert] 33#33 connect(7, unix:/opt/unit/unit.sock) succeed, address already in use
(venv) /opt/netbox/netbox $ ✅ Unit configuration loaded successfully
^C                                               
(venv) /opt/netbox/netbox $ ps                   
PID   USER     TIME  COMMAND                     
    1 1000      0:00 /sbin/tini -- /opt/netbox/docker-entrypoint.sh /opt/netbox/launch-netbox.sh
    7 1000      0:00 {unitd} unit: main v1.23.0 [unitd --no-daemon --control unix:/opt/unit/unit.sock --pid /opt/unit/unit.pid --log /dev/stdout --state /opt/unit/state/ --tmp /opt/unit/tmp/ --user unit --group root
   17 1000      0:00 {unitd} unit: controller
   18 1000      0:00 {unitd} unit: router
   22 1000      0:06 {unitd} unit: "netbox" application
   27 1000      0:05 {unitd} unit: "netbox" application
   28 1000      0:00 sh
   38 1000      0:00 ps
(venv) /opt/netbox/netbox $ python3 -m netbox_proxbox
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
/opt/netbox/venv/bin/python3: No module named netbox_proxbox.__main__; 'netbox_proxbox' is a package and cannot be directly executed
(venv) /opt/netbox/netbox $ python3 manage.py migrate
🧬 loaded config '/etc/netbox/config/configuration.py'
🧬 loaded config '/etc/netbox/config/extra.py'
🧬 loaded config '/etc/netbox/config/logging.py'
🧬 loaded config '/etc/netbox/config/plugins.py'
Operations to perform:
  Apply all migrations: admin, auth, circuits, contenttypes, dcim, django_rq, extras, ipam, sessions, social_django, taggit, tenancy, users, virtualization, wireless
Running migrations:
  No migrations to apply.
(venv) /opt/netbox/netbox $

Do you have any idea what I could try or how I could get more info out of the netbox, so that I can find out why loading the plugin doesn't happen?

Best regards,
Andre

Add individual VM update

Currently is possible only to run full update of the whole Proxmox, not individually by each VM.
The package function is already done and can be accessed through the following function:

netbox_proxbox.proxbox_api.update.virtual_machine()

It just need a way to be called though the GUI (recommended creating an button on Virtual Machine page) using Django, whether it's passing it directly to the database or making an API call.

Some usage examples of the function:

  1. Update VM using Netbox ID:
netbox_proxbox.proxbox_api.update.virtual_machine(id = 3)
  1. Update VM using Proxmox ID:
netbox_proxbox.proxbox_api.update.virtual_machine(proxmox_id = 414)
  1. Update VM using name:
netbox_proxbox.proxbox_api.update.virtual_machine(name = Netbox)

сannot create new vm/ct

running "Proxmox Full update" not create new vm/ct

in log i have

ноя 03 11:24:15 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:29 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:48 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:49 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:52 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:53 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:24:55 netbox gunicorn[272299]: Bad Request: /api/virtualization/virtual-machines/                                                                                                                                                
ноя 03 11:25:11 netbox gunicorn[272298]: [Proxbox - Netbox plugin | Update All]                                                                                                                                                            
ноя 03 11:25:11 netbox gunicorn[272298]: CLUSTER...                                                                                                                                                                                        
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] CLUSTER created. -> pve-company                                                                                                                                                               
ноя 03 11:25:11 netbox gunicorn[272298]: NODES...                                                                                                                                                                                          
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] NODE already updated. -> pve-04                                                                                                                                                              
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] NODE already updated. -> apollo-pve-15                                                                                                                                                       
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] NODE already updated. -> apollo-pve-06                                                                                                                                                       
.....                                                                                                                                         
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] NODE already updated. -> apollo-pve-12                                                                                                                                                       
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] NODE already updated. -> apollo-pve-03                                                                                                                                                       
ноя 03 11:25:11 netbox gunicorn[272298]: VIRTUAL MACHINES...                                                                                                                                                                               
ноя 03 11:25:11 netbox gunicorn[272298]: UPDATE ALL...                                                                                                                                                                                     
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] VM already updated. -> zabbix.company                                                                                                                                                    
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] VM already updated. -> mssql.company                                                                                                                                            
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] VM already updated. -> win2012srv                  
....
ноя 03 11:25:11 netbox gunicorn[272298]: [OK] VM does not exist on Netbox -> testvm-03
ноя 03 11:25:11 netbox gunicorn[272298]: [proxbox.create.virtual_machine] Creation of VM/CT failed.
ноя 03 11:25:11 netbox gunicorn[272298]: [ERROR] VM not created. -> testvm-03
......
ноя 03 11:25:16 netbox gunicorn[272298]: [OK] VM already updated. -> ns02.company                            
ноя 03 11:25:16 netbox gunicorn[272298]: REMOVE UNUSED DATA...                                              
ноя 03 11:25:16 netbox gunicorn[272298]: [OK] VM exists on both systems (Netbox and Proxmox) -> 1c-lic.company
ноя 03 11:25:16 netbox gunicorn[272298]: [OK] VM exists on both systems (Netbox and Proxmox) -> 1c.lic.company

netbox version 3.3.1

Automatically create Node devices, as it happens with Virtual Machines and Cluster

The Node device (the Server which compose the Cluster) is currently created manually.

The idea is:
1. Create the Cluster (with basic Cluster Type, if none is found)
2. Create the Server Nodes and link it to Cluster
3. Create Virtual Machines and Containers, also linking to Cluster.

OBS: The VM/CT should be linked to Cluster! There's no reason to try linking to Node, although it's useful to know which Node the VM belongs, but it is already done by adding an Custom Field with that information.

problem : /plugins/proxbox/full_update/

<class 'pynetbox.core.query.RequestError'>

The request failed with code 400 Bad Request but more specific details were not returned in json. Check the NetBox Logs or investigate this exception's error attribute.

Python version: 3.9.2
NetBox version: 3.2.5

ValueError at /plugins/proxbox/full_update/

Hi,

I'm trying to add the netbox-proxbox plugin to Netbox and get the following when I'm trying to do "Full update".

The script succeeded in copying 3 VMs from the proxmox cluster in addition to the node-names and cluster-name.

Then it balked on the third CT, added it twice and throws the following error:

The cluster is quite large (around 18 machines).

Thanks in advance,
Rickard

Environment:


Request Method: GET
Request URL: https://<IP>/plugins/proxbox/full_update/

Django Version: 3.2.6
Python Version: 3.8.0
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'django_rq',
 'drf_yasg',
 'nextbox_ui_plugin.NextBoxUIConfig',
 'netbox_proxbox.ProxboxConfig']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'netbox.middleware.ExceptionHandlingMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.LoginRequiredMiddleware',
 'netbox.middleware.APIVersionMiddleware',
 'netbox.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']



Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/urls.py", line 19, in full_update_view
    update_all_result = proxbox_api.update.all(remove_unused = True)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 420, in all
    node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 342, in nodes
    netbox_search = nb.dcim.devices.get(name = proxmox_node_name)
  File "/opt/netbox/venv/lib/python3.8/site-packages/pynetbox-6.1.3-py3.8.egg/pynetbox/core/endpoint.py", line 147, in get
    raise ValueError(

Exception Type: ValueError at /plugins/proxbox/full_update/
Exception Value: get() returned more than one result. Check that the kwarg(s) passed are valid for this endpoint or use filter() or all() instead.

footer.html error django.template.exceptions.TemplateDoesNotExist

<class 'django.template.exceptions.TemplateDoesNotExist'>

footer.html

Python version: 3.8.10
NetBox version: 3.2.0
Netbox-proxbox 0.0.4

If I comment out footer.html on the following files in netbox_proxbox/templates/netbox_proxbox/ everything works fine.
proxmox_vm_full_update.html
proxmox_vm_list.html
home.html

netbox-proxbox and netbox 3.4.x

Hi there!

First, Thank you for putting this together.

Have you tried netbox-proxbox with netbox3.4.x ?

with 3.3.x things seem to work as anticipated.

when attempting to enable the 0.0.5 version of the plugin in netbox3.4.x, netbox whines, moans, and ultimately fails:

netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox-docker_netbox_1 exited with code 143

This is running in Netbox-docker .. using netbox ver 3.4.1 and
netbox-proxmox version="0.0.5-beta1"

Figured you'd want to know!

Improve Proxbox documentation

I will probably use ReadTheDocs to create a complete documentation, including:

Documentation (Initial Blueprint)

  • How to install

    • Using Python package (production use)
    • Using GitHub repository (development use)
  • How to use

    • Understanding how Proxbox integrates with Proxmox
    • How to use Full update feature (mirror what is in Proxmox)
  • Compatibility documentation

    • What Netbox versions work with Proxbox plugin
  • How to contribute!

    • I am pretty happy to see many people using Proxbox, but it cames with a cost: a lot of bugs! Although I am aware about them, it is pretty hard to solve it as fast as I would like to do.
    • I will make a detailed documentation about the plugin architecture and hope to have some help from Netbox community in the plugin development.

VM info for ethernet device and IP and other VM information not automatically created and associated

Currently only LXC container IPs and interfaces are recorded, but not VM IPs, MACs, interfaces and hostnames, even with QEMU agent installed.

Option 1: use qemu-guest-agent to get info

apt install qemu-guest-agent
enabling the Guest agent flag in the VM config (in the GUI -> VM -> 'Options')

Proxmox VM Summary now lists IP and actual interface.

Use pvesh commands in following comment to get interface name, IP address and hostname.

Option 2: Use arp to get basic IP info

Look for the mac address in the configuration of the vm. In my example: vmid = 1176

Code:
~# qm config 1176 | grep net
boot: order=scsi0;ide2;net0
net0: virtio=4E:57:9F:01:4E:6F,bridge=vmbr12,firewall=1

Now you can use "arp" to get the current IP address from the MAC:

Code:
~# arp -n | grep -i 4E:57:9F:01:4E:6F
10.12.4.59 ether 4e:57:9f:01:4e:6f C vmbr12

The problem with the template footer.html

Good afternoon, I ran into the same mistake as people before me. I took the full config located in the README, but it still doesn't help.

Python version: 3.8.10
NetBox version: 3.4.2

an example of how I made the config

TEMPLATES_DIR = BASE_DIR + '/templates'

# PROXBOX CUSTOM TEMPLATE
PROXBOX_TEMPLATE_DIR = BASE_DIR + '/netbox-proxbox/netbox_proxbox/templates/netbox_proxbox'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [TEMPLATES_DIR, PROXBOX_TEMPLATE_DIR],  # <--- IMPORTANT
        # The Parameters below is equal to default Netbox config
        'APP_DIRS': True,
        'OPTIONS': {
            'builtins': [
                'utilities.templatetags.builtins.filters',
                'utilities.templatetags.builtins.tags',
            ],
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.template.context_processors.media',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'netbox.context_processors.settings_and_registry',
            ],
        },
    },
]

Multiple datacenter configuratrion

Hello,
I have many proxmox datacener. I would like proxbox to be configured to be able to retrieve data from each of them. Unfortunately, I can't configure it that way. In the 'settings.py' file I tried to duplicate the 'proxmox' or 'netbox_proxbox' sections, but the second settings overwritten the former.

Is it possible to configure a proxbox with multiple proxmox instances at all?

Thank you in advance for your help

Temporary failure in name resolution

Hi!

i was interested when i found your project, so i thought i'd give it a go.

I use a fresh netbox instance with nothing in it and a fresh install of netbox-proxbox, with the new fix that was supplied 1-2 days ago.
I get following error:

<class 'requests.exceptions.ConnectionError'>

HTTPSConnectionPool(host='https', port=8006): Max retries exceeded with url: /api2/json/cluster/status (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fc702b2bdf0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

Python version: 3.8.10
NetBox version: 3.1.8

My Config looks like this:

PLUGINS_CONFIG = {
    'netbox_proxbox': {
        'proxmox': {
            'domain': 'https://proxmox.bit.lan/',    # May also be IP address
            'http_port': 443,
            'user': 'root@pam',
            'password': '####',
            'token': {
                'name': '####',   # Only type the token name and not the 'user@pam:tokenID' format
                'value': '####'
            },
            'ssl': True
        },
        'netbox': {
            'domain': 'netbox.bit.lan',     # May also be IP address
            'http_port': 80,
            'token': '####',
            'ssl': False,       # There is no support to SSL on Netbox yet, so let it always False.
            'settings': {
                'virtualmachine_role_id' : 0,
                'node_role_id' : 0,
                'site_id': 0
            }
        }
    }
}

The configured domain is resolvable from the machine itself, so is proxbox probably ignoring the set configuration of http_port 443?

root@netbox:/opt/netbox# ping proxmox.bit.lan
PING #### (proxmox.bit.lan) 56(84) bytes of data.
64 bytes from #### (proxmox.bit.lan): icmp_seq=1 ttl=58 time=0.780 ms
64 bytes from #### (proxmox.bit.lan): icmp_seq=2 ttl=58 time=0.948 ms
64 bytes from #### (proxmox.bit.lan): icmp_seq=3 ttl=58 time=0.824 ms

Get Network information from Proxmox (IP address from VM's and Containers, MAC address, etc...)

Discussed in #51

Originally posted by quiknick May 10, 2022
Currently only LXC container IPs and interfaces are recorded, but not VM IPs, MACs, interfaces and hostnames, even with QEMU agent installed.

Option 1: use qemu-guest-agent to get info

apt install qemu-guest-agent
enabling the Guest agent flag in the VM config (in the GUI -> VM -> 'Options')

Proxmox VM Summary now lists IP and actual interface.

Use pvesh commands in following comment to get interface name, IP address and hostname.

Option 2: Use arp to get basic IP info

Look for the mac address in the configuration of the vm. In my example: vmid = 1176

Code:
~# qm config 1176 | grep net
boot: order=scsi0;ide2;net0
net0: virtio=4E:57:9F:01:4E:6F,bridge=vmbr12,firewall=1

Now you can use "arp" to get the current IP address from the MAC:

Code:
~# arp -n | grep -i 4E:57:9F:01:4E:6F
10.12.4.59 ether 4e:57:9f:01:4e:6f C vmbr12

Change log structure.

Example using proxbox.remove.all()

[How it is now]

 {
    "name": "nfsen",
    "result": false,
    "log": [
      "[OK] VM existe em ambos sistemas -> nfsen"
    ]
  }

[How it must be]

 {
    "name": "nfsen",
    "result": false,
    "log": {
        "ok" : [ ],
        "warning" : [ ],
        "error" : [ ]
    }
  }

Problem open template

The complete exception is provided below:

<class 'django.template.exceptions.TemplateDoesNotExist'>

footer.html

Python version: 3.9.6
NetBox version: 3.2.2

version netbox-proxbox 0.04

Running into Error when starting the Proxmox Full Update

I run a fresh Netbox Installation and added the Plugin according to the Documentation (used the git repository).
When running the "Proxmox Full Update", I get the error message:

<class 'AttributeError'>

object has no attribute "slug"

Python version: 3.10.4
NetBox version: 3.2.4

I also tested to run the plugin in development mode to check if there are any differences, but I've got the same error page shown.
My setup looks like this:

Promox Version 7.2.3
netbox-proxbox version 0.0.5-beta1 (github)
Netbox version 3.2.4

Do you have any hint for me, what was going wrong?

im getting this error whentrying to run the migrate command part of install

(venv) ubuntu@apihub:/opt/netbox/netbox$ python3 manage.py migrate
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/in it.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/management/in it.py", line 363, in execute
settings.INSTALLED_APPS
File "/opt/netbox/venv/lib/python3.8/site-packages/django/conf/init.py", l ine 82, in getattr
self._setup(name)
File "/opt/netbox/venv/lib/python3.8/site-packages/django/conf/init.py", l ine 69, in _setup
self._wrapped = Settings(settings_module)
File "/opt/netbox/venv/lib/python3.8/site-packages/django/conf/init.py", l ine 170, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/netbox/netbox/netbox/settings.py", line 46, in
from netbox import configuration
File "/opt/netbox/netbox/netbox/configuration.py", line 241
PREFER_IPV4 = False
^
SyntaxError: invalid syntax

Proxbox cannot be found, yet is installed

Hello

I follow the production installation method in the documentation, yet when I try to execute the migrate command, I stumble upon an error:

python3 manage.py migrate
Traceback (most recent call last):
File "/opt/netbox-3.2.2/netbox/netbox/settings.py", line 591, in
plugin = importlib.import_module(plugin_name)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'netbox_proxbox'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/core/management/init.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/core/management/init.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/core/management/base.py", line 414, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/core/management/base.py", line 95, in wrapped
saved_locale = translation.get_language()
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/utils/translation/init.py", line 210, in get_language
return _trans.get_language()
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/utils/translation/init.py", line 65, in getattr
if settings.USE_I18N:
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/conf/init.py", line 87, in getattr
self._setup(name)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/conf/init.py", line 74, in _setup
self._wrapped = Settings(settings_module)
File "/opt/netbox-3.2.2/venv/lib/python3.8/site-packages/django/conf/init.py", line 183, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 848, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/netbox-3.2.2/netbox/netbox/settings.py", line 594, in
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_proxbox: Module not found. Check that the plugin module has been installed within the correct Python environment.

So the plugin is not found, but when I try to install the plugin again, I get this message:

sudo pip install netbox-proxbox
Requirement already satisfied: netbox-proxbox in /usr/local/lib/python3.8/dist-packages (0.0.2)

All commands are running in the same venv. I have now removed the plugin from the configuration.py file to keep my Netbox install working.

Does anyone know what is wrong here?

ImportError: cannot import name 'BaseTable'

When I am running
(venv) $ python3 manage.py migrate

I am getting this error message

File "/opt/netbox-3.2.0/venv/lib64/python3.8/site-packages/netbox_proxbox/tables.py", line 3, in
from utilities.tables import BaseTable
ImportError: cannot import name 'BaseTable' from 'utilities.tables' (/opt/netbox-3.2.0/netbox/utilities/tables.py)

Netbox version 3.2.0
Proxbox version 0.0.2
Python 3.8.12

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.