Plugins are packaged Django apps that can be installed alongside NetBox to provide custom functionality not present in the core application. Plugins can introduce their own models and views, but cannot interfere with existing components. A NetBox user may opt to install plugins provided by the community or build his or her own.
The NetBox plugin architecture allows for the following:
/plugins root path to provide browsable views for users.PLUGINS_CONFIG in configuration.py.Either by policy or by technical limitation, the interaction of plugins with NetBox core is restricted in certain ways. A plugin may not:
/plugins root. All plugin URLs are restricted to this path to prevent path collisions with core or other plugins.The instructions below detail the process for installing and enabling a NetBox plugin.
Download and install the plugin package per its installation instructions. Plugins published via PyPI are typically installed using pip. Be sure to install the plugin within NetBox's virtual environment.
$ source /opt/netbox/venv/bin/activate
(venv) $ pip install <package>
Alternatively, you may wish to install the plugin manually by running python setup.py install. If you are developing a plugin and want to install it only temporarily, run python setup.py develop instead.
In configuration.py, add the plugin's name to the PLUGINS list:
PLUGINS = [
'plugin_name',
]
If the plugin requires any configuration, define it in configuration.py under the PLUGINS_CONFIG parameter. The available configuration parameters should be detailed in the plugin's README file.
PLUGINS_CONFIG = {
'plugin_name': {
'foo': 'bar',
'buzz': 'bazz'
}
}
If the plugin introduces new database models, run the provided schema migrations:
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py migrate
Plugins may package static files to be served directly by the HTTP front end. Ensure that these are copied to the static root directory with the collectstatic management command:
(venv) $ cd /opt/netbox/netbox/
(venv) $ python3 manage.py collectstatic
Restart the WSGI service and RQ workers to load the new plugin:
# sudo systemctl restart netbox netbox-rq
Follow these steps to completely remove a plugin.
Remove the plugin from the PLUGINS list in configuration.py. Also remove any relevant configuration parameters from PLUGINS_CONFIG.
Use pip to remove the installed plugin:
$ source /opt/netbox/venv/bin/activate
(venv) $ pip uninstall <package>
Restart the WSGI service:
# sudo systemctl restart netbox
!!! note
This step is necessary only for plugin which have created one or more database tables (generally through the introduction of new models). Check your plugin's documentation if unsure.
Enter the PostgreSQL database shell to determine if the plugin has created any SQL tables. Substitute pluginname in the example below for the name of the plugin being removed. (You can also run the \dt command without a pattern to list all tables.)
netbox=> \dt pluginname_*
List of relations
List of relations
Schema | Name | Type | Owner
--------+----------------+-------+--------
public | pluginname_foo | table | netbox
public | pluginname_bar | table | netbox
(2 rows)
!!! warning
Exercise extreme caution when removing tables. Users are strongly encouraged to perform a backup of their database immediately before taking these actions.
Drop each of the listed tables to remove it from the database:
netbox=> DROP TABLE pluginname_foo;
DROP TABLE
netbox=> DROP TABLE pluginname_bar;
DROP TABLE