Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

Latest commit

 

History

History
137 lines (103 loc) · 8.06 KB

README.md

File metadata and controls

137 lines (103 loc) · 8.06 KB

netbox-qrgen

NetBox plugin to generate QR codes for assets

Based on/inspired by: k01ek/netbox-qrcode

CI/CD

status-badge Last Release Version Version PyPi

Code Analysis

Quality Gate Status Bugs

Meta

Code style Linter Types License Compatibility


Description

test

Features (not complete)

  • Generate QR Codes for your assets
  • Download them either as PNG or SVG
  • Directly print them via the Web interface

Compatibility

This plugin requires Netbox version >=3.3 to work. (Older versions are not tested)

NetBox Version Plugin Version
3.3 >=0.0.1
3.4 >=0.0.1
3.5 >=0.0.1

Installing

Review the official Netbox plugin documentation for installation instructions.

With pip (pypi)

/opt/netbox/venv/bin/pip install --no-warn-script-location netbox-qrgen

In the Netbox docker container

For adding to a NetBox Docker setup see the general instructions for using netbox-docker with plugins.

FROM netboxcommunity/netbox:v3.5.4

RUN \
    && /opt/netbox/venv/bin/pip install --no-warn-script-location \
    netbox-qrgen

Configuration

PLUGINS = [
    'netbox_qrgen_'
]

# default settings
PLUGINS_CONFIG = {
    "netbox_qrgen": {
        "qr_with_text": True,
        "qr_text_fields": ["name", "serial"],
        "qr_font": "Tahoma",
        "qr_width": "200px",
        "qr_custom_text": None,
        "qr_text_location": "right",
        "qr_version": 2,
        "qr_error_correction": 1,
        "qr_box_size": 6,
        "qr_border_size": 4,
        "labels": {
            "dcim.cable": [
                "tenant",
                "a_terminations.device",
                "a_terminations.name",
                "b_terminations.device",
                "b_terminations.name",
            ],
            "dcim.rack": [
                "tenant",
                "site",
                "facility_id",
                "name",
            ],
            "dcim.device": ["tenant", "name", "serial"],
            "dcim.inventoryitem": ["tenant", "name", "serial"],
            "circuits.circuit": ["tenant", "name", "serial"],
        },
    },
}

Custom settings

Setting Type Default value Description
qr_with_text bool True Generate a text with the specified infos besides the QR code.
qr_text_fields list[str] ["name", "serial"] Fields to add as a text to the QR code. All object properties can be used.
qr_font str Tahoma Font to use to generate the text. Included fonts: ArialBlack,ArialMT,JetBrainsMono,JetBrainsMonoBold,Tahoma,TahomaBold.
qr_width str 200px Size for the SVG image to render. Can be any HTML valid size.
qr_custom_text str None Custom text to be added to every QR code.
qr_text_location str right Where the text fields are rendered relative to the QR code
qr_version int 2 An integer from 1 to 40 that controls the size of the QR Code (the smallest, version 1, is a 21x21 matrix). More details here
qr_error_correction int 1 Error corrector for the QR code. Available options: 1,2,3,4. See the package docs for more details. The integer mapping is here
qr_box_size int 6 Controls how many pixels each "box" of the QR code is
qr_border_size int 4 controls how many boxes thick the border should be (the default is 4, which is the minimum according to the specs).

Contribution / Bugs

For suggestions for improvement, just open a pull request.

If you encounter any bugs, also just open an issue with a description of the problem.

TODO's

  • test