NetBox plugin that stores configuration diffs and checks templates compliance

Overview

Config Officer - NetBox plugin

NetBox plugin that deals with Cisco device configuration (collects running config from Cisco devices, indicates config changes, and checks templates compliance).

A plugin for NetBox to work with running-configuration of Cisco devices.

Compatible with NetBox 2.9 and higher versions only.

  • Collect actual information from Cisco devices (running_config, version, IP addresses, etc.) and shows it on a dedicated NetBox page.
  • Save Cisco running configuration in a local directory and display all changes with git-like diffs.
  • Set up configuration templates for distinct device roles, types.
  • Audit whether devices are configured according to appropriate template.
  • Export template compliance detailed information to Excel.

Preview.

Collect devices data: collect devices data

Templates compliance templates compliance

Installation and configuration

Watch YouTube video about installation and usage of the plugin

This instruction only describes how to install this plugin into Docker-compose instance of NetBox.

General installation steps and considerations follow the official guidelines. The plugin is available as a Python package from PyPi or from GitHub.

0. Pull NetBox docker-compose version from GitHub

mkdir ~/netbox && cd "$_"
git clone https://github.com/netbox-community/netbox-docker

1. Create new docker container based on latest netbox image

cd ~/netbox
git clone https://github.com/artyomovs/netbox-plugin-config-officer
cd netbox-plugin-config-officer
sudo docker build -t netbox-myplugins .

What's in the Dockerfile:

FROM netboxcommunity/netbox:latest
RUN apk add iputils bind-tools openssh-client git
COPY ./requirements.txt /
COPY . /netbox-plugin-config-officer/
RUN /opt/netbox/venv/bin/pip install install -r /requirements.txt
RUN /opt/netbox/venv/bin/pip install  --no-warn-script-location /netbox-plugin-config-officer/

2. Create local git repository and perform first commit

mkdir ~/netbox/netbox-docker/device_configs && cd "$_"
git init
echo hello > hello.txt
git add .
git commit -m "Initial"
chmod 777 -R ../device_configs

3. Change netbox service in docker-compose.yml (do not delete, just add new lines and change image name)

version: '3.4'
services:
  netbox: &netbox
    # Change image name to netbox-myplugins (old name is netboxcommunity/netbox:${VERSION-latest})
    image: netbox-myplugins
    ...
    #...Add environment variables for git:
    environment:
      - GIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git
      - GIT_COMMITTER_NAME=netbox
      - [email protected]
    # user: '101' <---   Comment this. I don't know how to make ssh work with this line as for now.
    volumes:        
    #...add this volume:...
      - ./device_configs:/device_configs:z
    ports:
    - 8080:8080

4. Update the PLUGINS parameter in the global Netbox configuration.py config file in netbox-docker/configuration directory

PLUGINS = [
    "config_officer"
]

Update a PLUGINS_CONFIG parameter in configuration.py to change plugin's options:

PLUGINS_CONFIG = {
    "config_officer": {
        # Credentials to cisco devices:
        "DEVICE_USERNAME": "cisco",
        "DEVICE_PASSWORD": "cisco",

        # Mount this directory to NetBox on docker-compose.yml
        "NETBOX_DEVICES_CONFIGS_DIR": "/device_configs",

        # Add these custom fields to NetBox in advance.
        "CF_NAME_SW_VERSION": "version",
        "CF_NAME_SSH": "ssh",
        "CF_NAME_LAST_COLLECT_DATE": "last_collect_date",
        "CF_NAME_LAST_COLLECT_TIME": "last_collect_time",
        "CF_NAME_COLLECTION_STATUS": "collection_status"
    }
}

6. Start Docker-compose

$ cd ~/netbox/netbox-docker/
sudo docker-compose up -d

7. When NetBox is started - open the web interface http://NETBOX_IP:8080 and open Admin panel in right top corner and create elements

Custom Links

Name Content type URL
collect_device_data dcim > device http://NETBOX_IP:8080/plugins/config_officer/collect_device_config/{{ obj }}
show_running_config dcim > device http://NETBOX_IP:8080/plugins/config_officer/running_config/{{ obj.name }}

Custom Fields (optional)

Name Label Object(s)
collection_status Last collection status dcim > device
last_collect_date Date of last collection dcim > device
last_collect_time Time of last collection dcim > device
ssh SSH enabled dcim > device
version Software version dcim > device

Usage

Follow the YouTube link and to see the full installation and usage instruction.

Collection

Just add all needed Custom Links and Custom Fields (optionally) and have fun.

Templates compliance

After plugin is installed, additional menu "Plugin" will appear in top navi panel. For templates compliance feature you need to follow this three-step scenario:

  • Step1. Add template (e.g. for particular section)
  • Step2. Add a service. Inside service, add service rules, that will match template for particular device roles and device types.
  • Step3. Attach service to devices.

compliance_list

All matched templates will be merged into one big-boss template, which will be compared with an actual running-config.

Schedule config collection

If you want to schedule global collection from all devices (e.g. every night at 3 a.m, like all cron-users do.) - you could use API. Just add this line to cron:

curl --location --request POST 'http://NETBOX_IP:8080/api/plugins/config_officer/collection/' --header 'Authorization: Token YOUR_TOKEN' --form 'task="global_collection"'
Comments
  • 404 Page not found

    404 Page not found

    Hi,

    Thanks for the plugin, similar I gave it a go after watching your YouTube video and installed it through PyPi. (NetBox version v2.10.3) However getting a "Page not found error" when running the "collect_device_data".

    Not sure where I can look to troubleshoot what might be going wrong.

    cheers

    Alexander

    opened by alexanderdeca 7
  • NetBox v3.0 Support

    NetBox v3.0 Support

    As an FYI here is what changed that could impact or help the plugin:

    • HTML Template updates (support change from bootstrap 3 to bootstrap 5)
    • Overall UI tweaks
    • Custom Queue Support for Plugins netbox-community/netbox/issues/6651

    If you find any issues or have any questions feel free to hit us on the slack or add a bug /issue or add to the umbrella UI issue netbox-community/netbox/issues/6797

    opened by ryanmerolle 3
  • NameSlugSearchFilterSet Problem

    NameSlugSearchFilterSet Problem

    Hi! After install without docker, i have a problem:

    <class 'ImportError'>
    
    cannot import name 'NameSlugSearchFilterSet' from 'utilities.filters' (/opt/netbox/netbox/utilities/filters.py)
    
    Python version: 3.8.5
    NetBox version: 2.11.3
    

    How i may fix it ?

    opened by Sivolen 3
  • Cannot start service netbox-housekeeping

    Cannot start service netbox-housekeeping

    Hi. I can not deploy netbox-plugin config-officer. I received an error trying to create netbox-docker_netbox-housekeeping_1_2da30c. Could you help me with this? I'm following step-by-step, from github and youtube.

    I'm using Ubuntu: 20.04.3 LTS with vagrant/virtualbox.

    Creating netbox-docker_redis_1_eda484f67269 ... done Creating netbox-docker_postgres_1_d9596c0d647a ... done Creating netbox-docker_redis-cache_1_bbd69de6aef9 ... done Recreating netbox-docker_netbox-housekeeping_1_2da30cc7e86e ... error Creating netbox-docker_netbox-worker_1_269284fe7c9d ...

    ERROR: for netbox-docker_netbox-housekeeping_1_2da30cc7e86e Cannot start service netbox-housekeeping: driver failed programming external connectivity on endpoint netbox-docker_netbox-housekeeping_1_2da30cc7e86e (Creating netbox-docker_netbox-worker_1_269284fe7c9d ... done Creating netbox-docker_netbox_1_28722ab27218 ... error

    ERROR: for netbox-docker_netbox_1_28722ab27218 Cannot start service netbox: driver failed programming external connectivity on endpoint netbox-docker_netbox_1_5cb5c8adec32 (d5516554e621d0452f9d64074071c81e5f64ef273582c0540b1a5c33f535a116): Bind for 0.0.0.0:8080 failed: port is already allocated

    opened by pslencinas 1
  • Transitioning to a more standard configuration collection engine

    Transitioning to a more standard configuration collection engine

    This project looks great. This is something I have had long on my to-do list for our org and I am happy to see someone else needing almost the exact same functionality. My proposition is to replace or extend collect.py's functionality to allow for a more robust configuration collection engine. To be specific, there are already several well designed network configuration collection softwares that can be hooked into to get the same data

    If this is something the author would be willing to accept, I can begin working on a PR

    opened by MajesticFalcon 1
  • Problem for install plugin

    Problem for install plugin

    Hi,

    I'm the problem for install the plugin 'config_officer' (https://github.com/artyomovs/netbox-plugin-config-officer).

    I tried using docker but I get the wrong below: -- > ImportError: cannot import name 'PrimaryModelFilterSet' from 'netbox.filtersets' (/opt/netbox/netbox/netbox/filtersets.py)

    I tried using pip install netbox-plugin-config-officer, it installed but after configure and restart service I get the mensage:

    <class 'django.urls.exceptions.NoReverseMatch'>

    'config_officer' is not a registered namespace inside 'plugins'

    Python version: 3.8.10 NetBox version: 3.2.5-dev

    opened by RenatoPereira91 1
  • Installation problem

    Installation problem

    Installation problem

    <class 'ImportError'>

    cannot import name 'NameSlugSearchFilterSet' from 'utilities.filters' (/opt/netbox/netbox/utilities/filters.py)

    Python version: 3.9.2 NetBox version: 3.1.5

    opened by whitejuly07 0
  • No docker install problem

    No docker install problem

    Hello. I installed the plugin via upgrade.sh knowingly downloading it via pip and adding it to local_requirements.txt. I also added the plugin to configuration.py When I start the web interface I get

    <class 'ImportError'>

    cannot import name 'COL_TENANT' from 'tenancy.tables' (/opt/netbox/netbox/tenancy/tables.py)

    Python version: 3.8.5 NetBox version: 2.11.0

    opened by tetesh 0
Releases(netbox-plugin)
Data-Scrapping SEO - the project uses various data scrapping and Google autocompletes API tools to provide relevant points of different keywords so that search engines can be optimized

Data-Scrapping SEO - the project uses various data scrapping and Google autocompletes API tools to provide relevant points of different keywords so that search engines can be optimized; as this infor

Vibhav Kumar Dixit 2 Jul 18, 2022
A curated list of awesome mathematics resources

A curated list of awesome mathematics resources

Cyrille Rossant 6.7k Jan 05, 2023
Crystal Smp plugin for show scoreboards

MCDR-CrystalScoreboards Crystal plugin for show scoreboards | Only 1.12 Usage !!s : Plugin help message !!s hide : Hide scoreboard !!s show : Show Sco

CristhianCd 3 Oct 12, 2021
This is a template (starter kit) for writing Maturity Work with Sphinx / LaTeX at Collège du Sud

sphinx-tm-template Ce dépôt est un template de base utilisable pour écrire ton travail de maturité dans le séminaire d'informatique du Collège du Sud.

6 Dec 22, 2022
A curated list of awesome tools for Sphinx Python Documentation Generator

Awesome Sphinx (Python Documentation Generator) A curated list of awesome extra libraries, software and resources for Sphinx (Python Documentation Gen

Hyunjun Kim 831 Dec 27, 2022
Dev Centric Tools for Mkdocs Based Documentation

docutools MkDocs Documentation Tools For Developers This repo is providing a set of plugins for mkdocs material compatible documentation. It is meant

Axiros GmbH 14 Sep 10, 2022
Clases y ejercicios del curso de python diactodo por la UNSAM

Programación en Python En el marco del proyecto de Inteligencia Artificial Interdisciplinaria, la Escuela de Ciencia y Tecnología de la UNSAM vuelve a

Maximiliano Villalva 3 Jan 06, 2022
Automatically open a pull request for repositories that have no CONTRIBUTING.md file

automatic-contrib-prs Automatically open a pull request for repositories that have no CONTRIBUTING.md file for a targeted set of repositories. What th

GitHub 8 Oct 20, 2022
Generate a single PDF file from MkDocs repository.

PDF Generate Plugin for MkDocs This plugin will generate a single PDF file from your MkDocs repository. This plugin is inspired by MkDocs PDF Export P

198 Jan 03, 2023
Fast, efficient Blowfish cipher implementation in pure Python (3.4+).

blowfish This module implements the Blowfish cipher using only Python (3.4+). Blowfish is a block cipher that can be used for symmetric-key encryption

Jashandeep Sohi 41 Dec 31, 2022
A simple flask application to collect annotations for the Turing Change Point Dataset, a benchmark dataset for change point detection algorithms

AnnotateChange Welcome to the repository of the "AnnotateChange" application. This application was created to collect annotations of time series data

The Alan Turing Institute 16 Jul 21, 2022
API spec validator and OpenAPI document generator for Python web frameworks.

API spec validator and OpenAPI document generator for Python web frameworks.

1001001 249 Dec 22, 2022
Build AGNOS, the operating system for your comma three

agnos-builder This is the tool to build AGNOS, our Ubuntu based OS. AGNOS runs on the comma three devkit. NOTE: the edk2_tici and agnos-firmare submod

comma.ai 21 Dec 24, 2022
Feature Store for Machine Learning

Overview Feast is an open source feature store for machine learning. Feast is the fastest path to productionizing analytic data for model training and

Feast 3.8k Dec 30, 2022
A document format conversion service based on Pandoc.

reformed Document format conversion service based on Pandoc. Usage The API specification for the Reformed server is as follows: GET /api/v1/formats: L

David Lougheed 3 Jul 18, 2022
Template repo to quickly make a tested and documented GitHub action in Python with Poetry

Python + Poetry GitHub Action Template Getting started from the template Rename the src/action_python_poetry package. Globally replace instances of ac

Kevin Duff 89 Dec 25, 2022
Version bêta d'un système pour suivre les prix des livres chez Books to Scrape,

Version bêta d'un système pour suivre les prix des livres chez Books to Scrape, un revendeur de livres en ligne. En pratique, dans cette version bêta, le programme n'effectuera pas une véritable surv

Mouhamed Dia 1 Jan 06, 2022
Documentation of the QR code found on new Austrian ID cards.

Austrian ID Card QR Code This document aims to be a complete documentation of the format used in the QR area on the back of new Austrian ID cards (Per

Gabriel Huber 9 Dec 12, 2022
My solutions to the Advent of Code 2021 problems in Go and Python 🎄

🎄 Advent of Code 2021 🎄 Summary Advent of Code is an annual Advent calendar of programming puzzles. This year I am doing it in Go and Python. Runnin

Orfeas Antoniou 16 Jun 16, 2022
💡 Catatan Materi Bahasa Pemrogramman Python

Repository catatan kuliah Andika Tulus Pangestu selama belajar Dasar Pemrograman dengan Python.

0 Oct 10, 2021