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)
step by step guide for beginners for getting started with open source

Step-by-Step Guide for beginners for getting started with Open-Source Here The Contribution Begins 💻 If you are a beginner then this repository is fo

Arpit Jain 66 Jan 03, 2023
Yet Another MkDocs Parser

yamp Motivation You want to document your project. You make an effort and write docstrings. You try Sphinx. You think it sucks and it's slow -- I did.

Max Halford 10 May 20, 2022
204-python-string-21BCA90 created by GitHub Classroom

204-Python This repository is created for subject "204 Programming Skill" Python Programming. This Repository contain list of programs of python progr

VIDYABHARTI TRUST COLLEGE OF BCA 6 Mar 31, 2022
Code and pre-trained models for "ReasonBert: Pre-trained to Reason with Distant Supervision", EMNLP'2021

ReasonBERT Code and pre-trained models for ReasonBert: Pre-trained to Reason with Distant Supervision, EMNLP'2021 Pretrained Models The pretrained mod

SunLab-OSU 29 Dec 19, 2022
An interview engine for businesses, interview those who are actually qualified and are worth your time!

easyInterview V0.8B An interview engine for businesses, interview those who are actually qualified and are worth your time! Quick Overview You/the com

Vatsal Shukla 1 Nov 19, 2021
Bring RGB to life in Neovim

Bring RGB to life in Neovim Change your RGB devices' color depending on Neovim's mode. Fast and asynchronous plugin to live your vim-life to the fulle

Antoine 40 Oct 27, 2022
Python code for working with NFL play by play data.

nfl_data_py nfl_data_py is a Python library for interacting with NFL data sourced from nflfastR, nfldata, dynastyprocess, and Draft Scout. Includes im

82 Jan 05, 2023
Simple yet powerful CAD (Computer Aided Design) library, written with Python.

Py-MADCAD it's time to throw parametric softwares out ! Simple yet powerful CAD (Computer Aided Design) library, written with Python. Installation

jimy byerley 124 Jan 06, 2023
Cleaner script to normalize knock's output EPUBs

clean-epub The excellent knock application by Benton Edmondson outputs EPUBs that seem to be DRM-free. However, if you run the application twice on th

2 Dec 16, 2022
Collection of Summer 2022 tech internships!

Collection of Summer 2022 tech internships!

Pitt Computer Science Club (CSC) 15.6k Jan 03, 2023
Showing potential issues with merge strategies

Showing potential issues with merge strategies Context There are two branches in this repo: main and a feature branch feat/inverting-method (not the b

Rubén 2 Dec 20, 2021
A Collection of Cheatsheets, Books, Questions, and Portfolio For DS/ML Interview Prep

Here are the sections: Data Science Cheatsheets Data Science EBooks Data Science Question Bank Data Science Case Studies Data Science Portfolio Data J

James Le 2.5k Jan 02, 2023
Test utility for validating OpenAPI documentation

DRF OpenAPI Tester This is a test utility to validate DRF Test Responses against OpenAPI 2 and 3 schema. It has built-in support for: OpenAPI 2/3 yaml

snok 106 Jan 05, 2023
The source code that powers readthedocs.org

Welcome to Read the Docs Purpose Read the Docs hosts documentation for the open source community. It supports Sphinx docs written with reStructuredTex

Read the Docs 7.4k Dec 25, 2022
Quick tutorial on orchest.io that shows how to build multiple deep learning models on your data with a single line of code using python

Deep AutoViML Pipeline for orchest.io Quickstart Build Deep Learning models with a single line of code: deep_autoviml Deep AutoViML helps you build te

Ram Seshadri 6 Oct 02, 2022
A system for Python that generates static type annotations by collecting runtime types

MonkeyType MonkeyType collects runtime types of function arguments and return values, and can automatically generate stub files or even add draft type

Instagram 4.1k Jan 07, 2023
Literate-style documentation generator.

888888b. 888 Y88b 888 888 888 d88P 888 888 .d8888b .d8888b .d88b. 8888888P" 888 888 d88P" d88P" d88""88b 888 888 888

Pycco 808 Dec 27, 2022
Tips for Writing a Research Paper using LaTeX

Tips for Writing a Research Paper using LaTeX

Guanying Chen 727 Dec 26, 2022
PythonCoding Tutorials - Small functions that would summarize what is needed for python coding

PythonCoding_Tutorials Small functions that would summarize what is needed for p

Hosna Hamdieh 2 Jan 03, 2022
epub2sphinx is a tool to convert epub files to ReST for Sphinx

epub2sphinx epub2sphinx is a tool to convert epub files to ReST for Sphinx. It uses Pandoc for converting HTML data inside epub files into ReST. It cr

Nihaal 8 Dec 15, 2022