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)
A plugin to introduce a generic API for Decompiler support in GEF

decomp2gef A plugin to introduce a generic API for Decompiler support in GEF. Like GEF, the plugin is battery-included and requires no external depend

Zion 379 Jan 08, 2023
Docov - Light-weight, recursive docstring coverage analysis for python modules

docov Light-weight, recursive docstring coverage analysis for python modules. Ov

Richard D. Paul 3 Feb 04, 2022
Data Inspector is an open-source python library that brings 15++ types of different functions to make EDA, data cleaning easier.

Data Inspector Data Inspector is an open-source python library that brings 15 types of different functions to make EDA, data cleaning easier. Author:

Kazi Amit Hasan 38 Nov 24, 2022
Fully reproducible, Dockerized, step-by-step, tutorial on how to mock a "real-time" Kafka data stream from a timestamped csv file. Detailed blog post published on Towards Data Science.

time-series-kafka-demo Mock stream producer for time series data using Kafka. I walk through this tutorial and others here on GitHub and on my Medium

Maria Patterson 26 Nov 15, 2022
Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI Specification v3.

Openapi-core is a Python library that adds client-side and server-side support for the OpenAPI Specification v3.

A 186 Dec 30, 2022
An awesome Data Science repository to learn and apply for real world problems.

AWESOME DATA SCIENCE An open source Data Science repository to learn and apply towards solving real world problems. This is a shortcut path to start s

Academic.io 20.3k Jan 09, 2023
MkDocs Plugin allowing your visitors to *File > Print > Save as PDF* the entire site.

mkdocs-print-site-plugin MkDocs plugin that adds a page to your site combining all pages, allowing your site visitors to File Print Save as PDF th

Tim Vink 67 Jan 04, 2023
the project for the most brutal and effective language learning technique

- "The project for the most brutal and effective language learning technique" (c) Alex Kay The langflow project was created especially for language le

Alexander Kaigorodov 7 Dec 26, 2021
Speed up Sphinx builds by selectively removing toctrees from some pages

Remove toctrees from Sphinx pages Improve your Sphinx build time by selectively removing TocTree objects from pages. This is useful if your documentat

Executable Books 8 Jan 04, 2023
A next-generation curated knowledge sharing platform for data scientists and other technical professions.

Knowledge Repo The Knowledge Repo project is focused on facilitating the sharing of knowledge between data scientists and other technical roles using

Airbnb 5.2k Dec 27, 2022
Python solutions to solve practical business problems.

Python Business Analytics Also instead of "watching" you can join the link-letter, it's already being sent out to about 90 people and you are free to

Derek Snow 357 Dec 26, 2022
Python Eacc is a minimalist but flexible Lexer/Parser tool in Python.

Python Eacc is a parsing tool it implements a flexible lexer and a straightforward approach to analyze documents.

Iury de oliveira gomes figueiredo 60 Nov 16, 2022
An introduction course for Python provided by VetsInTech

Introduction to Python This is an introduction course for Python provided by VetsInTech. For every "boot camp", there usually is a pre-req, but becaus

Vets In Tech 2 Dec 02, 2021
Documentation and issues for Pylance - Fast, feature-rich language support for Python

Documentation and issues for Pylance - Fast, feature-rich language support for Python

Microsoft 1.5k Dec 29, 2022
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
Zero configuration Airflow plugin that let you manage your DAG files.

simple-dag-editor SimpleDagEditor is a zero configuration plugin for Apache Airflow. It provides a file managing interface that points to your dag_fol

30 Jul 20, 2022
A web app builds using streamlit API with python backend to analyze and pick insides from multiple data formats.

Data-Analysis-Web-App Data Analysis Web App can analysis data in multiple formates(csv, txt, xls, xlsx, ods, odt) and gives shows you the analysis in

Kumar Saksham 19 Dec 09, 2022
Python document object mapper (load python object from JSON and vice-versa)

lupin is a Python JSON object mapper lupin is meant to help in serializing python objects to JSON and unserializing JSON data to python objects. Insta

Aurélien Amilin 24 Nov 09, 2022
Build documentation in multiple repos into one site.

mkdocs-multirepo-plugin Build documentation in multiple repos into one site. Setup Install plugin using pip: pip install git+https://github.com/jdoiro

Joseph Doiron 47 Dec 28, 2022
Manage your WordPress installation directly from SublimeText SideBar and Command Palette.

WordpressPluginManager Manage your WordPress installation directly from SublimeText SideBar and Command Palette. Installation Dependencies You will ne

Art-i desenvolvimento 1 Dec 14, 2021