ytti / netcrawl

LLDP/CDP crawler
60 stars 12 forks source link

Netcrawl

Given snmp community and single device, crawls the network via discovering LLDP/CDP neighbours, while producing list or dot file (for graphviz digraphs)

Install

% gem install netcrawl

Use

% netcrawl --graphiz router.example.com

Command line

Usage: netcrawl [options] hostname
    -g, --graphviz       dot output use 'dot -Tpng -o map.png map.dot'
    -l, --list           list nodes
    -j, --json           json output
    -y, --yaml           yaml output
    -a, --hash           hash/associative array output
    -r, --resolve        resolve addresses to names
    -p, --purge          remove peers not in configured CIDR
    -c, --community      SNMP community to use
    -d, --debug          turn debugging on
    -h, --help           Display this help message.

Config

---
use:
- LLDP
- CDP
poll:
- 192.0.2.0/24
snmp:
  community: public
  timeout: 1
  retries: 2
  bulkrows: 35
dot:
  bothlinks: true
  color:
  - - cpe
    - gold
  - - -sw
    - blue
  - - -pe
    - red
  - - ' -p'
    - yellow
dns:
  afi: 
log: STDERR
debug: false
namemap:
- - -re\d+
  - ''
- - (.*(?<!as23456.net)$)
  - \1.as23456.net

Library use

require 'netcrawl' output = NetCrawl.new.crawl('192.0.2.1').to_hash