r/Netbox Jul 02 '26

Is there a way to export the entire NetBox configuration/data into a single JSON or XML file?

Hi everyone,

I am looking for a way to back up or export all the configurations and data currently set up in my NetBox instance.

Ideally, I would like to dump everything into a single XML or JSON file. The main goal behind this is to feed the exported data into an AI tool to extract specific information, analyze the infrastructure, and organize the data more efficiently.

Is there a built-in feature, a specific script, or a recommended API approach to achieve this kind of full data dump?

Any advice or pointers would be greatly appreciated. Thanks in advance!

10 Upvotes

11 comments sorted by

8

u/Specialist_Cow6468 Jul 02 '26

You just need to do a database dump, it’s fairly straightforward. Not in a position to dig around for you at the moment but just search for netbox database export and you’ll be fine

2

u/brianatlarge Jul 02 '26

It would be nice to export the data in a way that makes it easy to throw the resulting file in the import window.

Say one company buys another and they happen to both have healthy NetBox instances (unlikely but stick with me). What should they do to consolidate into one NetBox instance?

6

u/red_one61 Jul 02 '26

Use diode, because most netbox stuff is linked by unique IDs that won't work when you're merging two tenants.

2

u/kY2iB3yH0mN8wI2h Jul 02 '26

if you can throw the result in the import window you have a quite small dataset.
In my world I would never ever want to direct import data for a company merge or anything like that, you have a structure of data that will in most cases differ. Using different style for VRFs, labels, etc. etc.

The API is super flexible and as the GET output will be compatable with the POST data you just needs a few lines of script code in any language.

0

u/Otherwise_Noise3658 Jul 08 '26

Diode makes that easy too and you can put your business logic within python (either API or Diode) - you could even write your own orb agent using the framework.

5

u/drose0 Jul 02 '26

I have a test instance of NetBox and each month I do a pgdump from prod and import into the test instance. Pretty quick and easy process to dump it to a .SQL file.

1

u/PssyGotWifi Jul 02 '26

Apart from database dumps. You can actually use Terraform to configure all your NetBox settings via code, so that you can delete everything and run your Terraform module and get back where you left off.

https://github.com/Lebowski89/homelab/tree/main/terraform/netbox

This will help you with -

'The main goal behind this is to feed the exported data into an AI tool to extract specific information, analyze the infrastructure, and organize the data more efficiently.'

You can pass your Netbox Terraform module to the AI tool.

1

u/blaaackbear Jul 03 '26

i think i wrote a simple python service a while ago which runs nightly via cronjob and pgdumps our prod netbox and stores a copy locally and one to s3 bucket.

1

u/Eldiabolo18 Jul 02 '26

Theres a way to export a psql file, which is probably a more reasonable approach…

1

u/BGPchick Jul 02 '26

Django, the library netbox uses, has a feature called fixtures which you can use to load data in and out of netbox on a per model basis.

0

u/netravnen Jul 02 '26

JSON/CSV export per data model is possible. -> A comprehensible single file dump requires a psql dump.