netbox-community / netbox-qrcode

NetBox Plugin for generate QR Codes
Apache License 2.0
209 stars 31 forks source link
netbox netbox-plugin

Netbox QR Code Plugin

Netbox plugin for generate QR codes for objects: Rack, Device, Cable.

This plugin depends on qrcode and Pillow python library

Downloads Downloads Downloads

Compatibility

Plugin Version NetBox Version Tested on
0.0.11 3.7.x 3.7.x
0.0.14 4.0.x v4.0.11
0.0.15 4.1.x v4.1.6

Installation

If Netbox was installed according to the standard installation instructions. It may be necessary to activate the virtual environment.

source /opt/netbox/venv/bin/activate

The plugin is available as a Python package in pypi and can be installed with pip

pip install netbox-qrcode

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

PLUGINS = ['netbox_qrcode']

Restart NetBox and add netbox-qrcode to your local_requirements.txt

Configuration

The following options are available:

Per object options

Per object options override default options. Per object options dictionary can contains any of default options inside.

Configuration example:

PLUGINS_CONFIG = {
    'netbox_qrcode': {
        'with_text': True,
        'text_fields': ['name', 'serial'],
        'font': 'ArialMT',
        'font_size': 12, # If the value is 0 or the line does not exist, then the text is automatically adjusted
        'custom_text': 'Property of SomeCompany\ntel.8.800333554-CALL',
        'text_location': 'up',
        'qr_version': 1,
        'qr_error_correction': 0,
        'qr_box_size': 4,
        'qr_border': 4,
        # per object options
        'cable': None,  # disable QR code for Cable object
        'rack': {
            'text_fields': [
                'site',
                'name',
                'facility_id',
                'tenant',
                'cf.cf_name'
            ]
        },
        'device': {
            'qr_box_size': 6,
            'custom_text': None,
        }
    }
}

Contributing

Developing tools for this project based on ntc-netbox-plugin-onboarding repo.

Issues and pull requests are welcomed.

Screenshots

Device QR code with text label Device QR Code

Rack QR code Rack QR Code

Cable QR code Cable QR Code

Device QR code via Jinja2 "text_template" Parameter (Multiline and labeled) Cable QR Code