Skip to main content

A NetBox Switch Configuration Backup Plugin

Project description

Netbox Configuration Backup

A configuration backup system using netbox and napalm to backup devices into a git repository

Features

  • Connects to any device that supports napalm and provides both a running configuration and startup configuration
  • Stores backups in a git repository
  • Runs as a scheduled task through Django RQ
  • Only displays backups with changes
  • Provides both configuration download and diffs for point-in-time backups

Future

  • Allow github repositories
  • Add job "discovery" based on specific criteria (napalm enabled, device role switch, has primary ip as an example)
  • Add RQ job to ensure all backups are queued
  • Allow manual queueing of job
  • Add API endpoint to trigger backup
  • Add signal(s) to trigger backup

Installation

  1. Install from PyPI (pip install netbox-config-backup)
  2. Edit netbox configuration:
PLUGINS = [
    'netbox_config_backup',
    # Other plugins here
]

PLUGINS_CONFIG = {
    'netbox_config_backup': {
        # Parent folder must exist and be writable by your RQ worker and readable by the WSGI process
        'repository': '/path/to/git/repository',
        'committer': 'User <email>',
        'author': 'User <email>',
        # Freqency of backups in seconds, can be anywhere 0+ (Recommended is 1800 (30 minutes) or 3600 (1 hr)
        'frequency': 3600
    }
}
  1. Migrate: python3 netbox/manage.py migrate
  2. Copy /etc/systemd/system/netbox-rq.service to /etc/systemd/system/ncb-rq@.service
  3. Edit: /etc/systemd/system/ncb-rq@.service: ExecStart:
ExecStart=/opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py rqworker --name ncb@%i --with-scheduler netbox_config_backup.jobs
  1. Reload systemd: systemctl daemon-reload
  2. Enable the service with x number of workers: systemctl enable ncb-rq@{1..10} (This will generate 10 worker symlinks to auto start)
  3. Start the service with x number of workers: systemctl start ncb-rq@{1..10} (This will start 10 workers)
  4. Create your first device backup

Logging

To enable logging, add the following to your configuration.py under LOGGING:

        'netbox_config_backup': {
            'handlers': ['enter_your_handlers_here'],
            'level': 'desired_log_level',
            'propagate': True,
        },

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_config_backup-2.1.1.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

netbox_config_backup-2.1.1-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

Details for the file netbox_config_backup-2.1.1.tar.gz.

File metadata

  • Download URL: netbox_config_backup-2.1.1.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for netbox_config_backup-2.1.1.tar.gz
Algorithm Hash digest
SHA256 75b1b1f029421c9ac7acdc65c59e3f18c44ca98b1f305e221b08281cdaaa644d
MD5 32e524c3dd61e4553565e6c7a4b82e62
BLAKE2b-256 95a539b7349c864785ca73fcf5d0c851f7ddf74edacd2eefcd50114b1afbeffd

See more details on using hashes here.

File details

Details for the file netbox_config_backup-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_config_backup-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d1665912abc3abfff55b5975a4fa5cfebd33e474531086f7255d8a2989b798a
MD5 2a860b1e7eda2c6a4b39c6278b35df13
BLAKE2b-256 87703cc6626999f24812a9e5975b677b87da9cd1bf34160bfc8eca614808e26f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page