Code Monkey home page Code Monkey logo

cisco-to-netbox-to-zabbix's Introduction

(Cisco + ESXI VM) -> Netbox -> Zabbix

Tested on Netbox 3.2 +

Tested on Zabbix 6 +

Cisco Devices:

  • Script uses "confluence url page" or "txt file in the same folder" to get ip list to connect
  • Script gathers all needed info by ssh
  • Parses data and writes into api/"device_name".csv files in json format (Some examples are in api folder)
  • Creates entities in Netbox (devices, interfaces, prefixes, ip addresses, vlans, cdp connections, inventory)
  • Zabbix script goes through all devices and creates/updates hosts on Zabbix server

ESXI VM:

  • Script gathers all needed info from ESXI server by "pyVim" module
  • Creates entities in Netbox

Details:

  • Script's main purpose is full integration between Cisco and Netbox (https://netbox.readthedocs.io/en/stable/)
  • Script works fine with IOS, NX-OS, XR, SG-220, Air-OS but can have some problems with "slow" devices when getting responce takes a long time.
  • Use -- help when running script in cmd

To run the script once a day in a background just add this line to crontab file:

  • 0 0 * * * (cd /path_to_script_folder && env/bin/python Cisco_To_Json.py -f confluence && env/bin/python Cisco_To_Netbox.py -l all && env/bin/python Netbox_To_Zabbix.py ) > /path_to_log_folder/Cron_Logs.txt
  • Examples to run basic script "Script Cisco_To_Json.py -f confluence | all | test"

Attention:

  • Script Cisco_To_Netbox uses custom fields, you must add these fields to write acl information
  • IMPORTANT! Devices are associated with sites by their hostname. Hostname MUST include a site_name. For example 78-SITE_NAME-ASW01. 78 - is a city code.
  • For Cisco ASR edit chars = ['RP/0/RSP0/CPU0:', '>', '#'] variable in Cisco_To_json.py according to your asr devices hostnames to cut theese chars off
  • Highly recommended to include "router" and "switch_layer_3" to device_role list in Netbox, this is a cryteria by which script adds description to prefixes

image

  • Script might fail trying to connect to some devices ,especially when connecting to more than 20 devices simultaneously in a thread.
  • Script worked fine and was tested in one Enterprise network environment only, and some templates were edited to work in that environment!

Instructions:

Create all needed folders first

image

  1. Edit yaml file
  2. Run a .py file in cmd or all of them via Cron, use --help to see all possible arguments

image

Снимок

cisco-to-netbox-to-zabbix's People

Contributors

guitarsoul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.