Note: I don’t yet have extensive experience on NetBox 2.9.x but these have been shown useful in earlier NetBox versions. I’ll update the page later if I find some further comments about the performance in NetBox 2.9.x. Speeding up fetching the devices Fetching lots of devices (hundreds or thousands, depending on the environment) with netbox.dcim.devices.all() […]
Pynetbox is a Python API client library for NetBox. Here are some basic examples of using pynetbox. In this page: Getting started Creating and changing something Retrieving objects Deleting objects Handling object status Using tags Referring to other objects Here we assume that you already have NetBox running (I have NetBox 2.8.6 in this demo), […]
A short memo how to backup any PostgreSQL database: In .pgpass (you should keep this file protected): netbox-db-backup.sh: That will also find and delete backup files older than MAXDAYS.
I made some improvements to the NetBox webhook listener presented in my earlier post. Here is the new one: Example from the log file: Notable changes: Added the message digest verification (X-Hook-Signature header sent by NetBox) Added content length checking as an example of all the worries you need to take care of when publishing […]
Note: There is an improved version in the next post. Following my earlier post about implementing a REST API, here is a simple listener for NetBox webhooks: webhook-listener.py: With the other configurations described in the earlier post (and after configured NetBox to send the webhook POST requests to http://my.server.local/webhook/), these are the outputs: webhook-listener.log: Automatically […]
When installing NetBox on Debian 9 and Apache, the instructions in http://netbox.readthedocs.io/en/latest/ are fine, just some small additional operations are needed. The libapache2-mod-wsgi-py3 package needs to be installed as well, otherwise you will get errors about the “WSGIPassAuthorization on” command when starting Apache [this has later been addressed in commit b917e8d] Disable the “000-default” site […]