Page MenuHomePhabricator

Netbox: generate CSV backups
Open, NormalPublic


Currently we're performing Postgresql backups of Netbox, but if a wrong edit is made it would be pretty hard to manually find the right values for a quick revert without having to restore the whole DB, potentially losing changes made by others.
We could, in addition to the DB backup, also perform backups in CSV form of the data, using the export to CSV function in Netbox.
A script in the netbox-deploy repo, that uses the already existing token should do the job and should be fairly simple to add.

Caveat: for the DCIM devices we should use the custom export all fields CSV method instead of the default one.

Things to be decided:

  • which objects to export (all?)
  • how frequent to perform the backup
  • in which structure
    • For this my suggestion would be something like:
  • how/when to rotate/compress the files

Event Timeline

Volans created this task.May 14 2019, 3:47 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMay 14 2019, 3:47 PM
Volans triaged this task as Normal priority.May 14 2019, 3:47 PM

Just to follow up on this. I did spend some time trying to figure out how to initiate a template-based export from hitting a URL. It seems as though there's no API-way, and hitting the URL endpoint doesn't work with a token authentication as far as I can tell.

That said, it'd be relatively trivial to use the API to export things, so I propose that we proceed by basically implementing the same functionality except via the API.

Change 518166 had a related patch set uploaded (by CRusnov; owner: CRusnov):
[operations/software/netbox-deploy@master] Add new script