Skip to content

Installation

Docker

Installing on Docker is fairly simple and documented by the Netbox Docker project. Just ensure to restart both the Netbox and Netbox-Worker container, as both will need to have nbxSync installed.

Also, replace netbox_secrets with nbxsync obviously.

Normal install

Prerequisites

  • NetBox >= 4.x
  • Python >= 3.8
  • Zabbix server >= 7.0

In order to install NetBox, please see their installation instructions. Once you have a working Netbox installation, proceed with the steps below.

Steps

Install the plugin

cd /opt/netbox/netbox/
source venv/bin/activate
pip install nbxsync
echo nbxsync >> /opt/netbox/local_requirements.txt

Configuration

If you want to change the default configuration, can add the following configuration and alter it accordingly. This is not required though.

netbox/configuration.py
PLUGINS = ['nbxsync']
PLUGINS_CONFIG = {
    "nbxsync": {
        'sot': {
            'proxygroup': 'netbox',
            'proxy': 'netbox',
            'macro': 'netbox',
            'host': 'netbox',
            'hostmacro': 'netbox',
            'hostgroup': 'netbox',
            'hostinterface': 'netbox',
            'hosttemplate': 'netbox',
            'maintenance': 'netbox',
        },
        'statusmapping': {
            'device': {
                'active': 'enabled',
                'planned': 'disabled',
                'failed': 'deleted',
                'staged': 'disabled',
                'offline': 'deleted',
                'inventory': 'deleted',
                'decommissioning': 'deleted',
            },
            'virtualmachine': {
                'offline': 'deleted',
                'active': 'enabled',
                'planned': 'enabled_in_maintenance',
                'paused': 'enabled_no_alerting',
                'failed': 'deleted',
            },
        },
        'snmpconfig': {
            'snmp_community': '{$SNMP_COMMUNITY}',
            'snmp_authpass': '{$SNMP_AUTHPASS}',
            'snmp_privpass': '{$SNMP_PRIVPASS}',
        },
        'inheritance_chain': [
            ['device'],
            ['role'],
            ['device', 'role'],
            ['role', 'parent'],
            ['device', 'role', 'parent'],
            ['device', 'device_type'],
            ['device_type'],
            ['device', 'platform'],
            ['platform'],
            ['device', 'device_type', 'manufacturer'],
            ['device_type', 'manufacturer'],
            ['device', 'manufacturer'],
            ['manufacturer'],
            ['cluster'],
            ['cluster', 'type'],
            ['type'],
        ],
        'backgroundsync': {
            'objects': {
                'enabled': True,
                'interval': 60, # 1 hour
            },
            'templates': {
                'enabled': True,
                'interval': 1440, # 24 hours
            },
            'proxies': {
                'enabled': True,
                'interval': 1440, # 24 hours
            },
            'maintenance': {
                'enabled': True,
                'interval': 15, # 15 minutes
            },
        },
        'no_alerting_tag': 'NO_ALERTING',
        'no_alerting_tag_value': '1',
        'maintenance_window_duration': 3600,
        'attach_objtag': True,
        'objtag_type': 'nb_type',
        'objtag_id': 'nb_id',
    }
}

Run migrations

python3 manage.py migrate nbxsync
python3 manage.py collectstatic --no-input

Restart services

sudo systemctl restart netbox netbox-worker