GithubHelp home page GithubHelp logo

zabbix-map-creator's Introduction

Zabbix map creator

The collection of the scripts that helps you build L2 network topology map in Zabbix

# Load arp table into database
./arp.py example.ini

# Collect fdb (mac address table) from switches
./get_mac_form_switches.py example.ini

# Build topology
./build_map.py example.ini

# Or you can check path to any switch in your network
./build_map.py example.ini --ip 10.0.0.245

# You can check any device in your network
cd device_modules
./dlink.py 10.0.0.1 admin admin
./snr.py 10.0.0.2 admin admin

You may have any number of topologies, each described in dedicated ini file. For example, ./arp.py example.ini

[network]
; switch's default gateway mac address
uplink_mac = 8479.735f.7dcd
; switches creditionals
sw_username = admin
sw_password = password
; sqlite database filename
database = db/example.db
; from wich file to load 'show ip arp'
file_with_arp = example_arp.txt
; cisco (sh ip arp) or linux (ip nei show)
arp_file_type = cisco

[zabbix]
; use zabbix.
; yes, true - build map in zabbix
; no, false - dont touch zabbix, generate only dot file with <mapname>
use_zabbix = yes
; zabbix api creditionals
username = Admin
password = zabbix
; zabbix server url
zbx_url = http://zabbix.example.com
; zabbix map to be created
mapname = Example_map

Collection of mac address tables from network devices Mac address tables are collected usin pexpect with telnet. No snmp, cdp, lldp, etc. Only screen scraping.

zabbix-map-creator's People

Contributors

infery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zabbix-map-creator's Issues

get_mac_form_switches.py crashes on operation timeout

Hi! Thank you for your software! It's very helpfull!
But, when we've try execute get_mac_form_switches.py script, we got back
these error:

Connect to 10.245.185.2 , vendor dlink
Traceback (most recent call last):
File "./get_mac_form_switches.py", line 100, in
mac_table = dlink.get_mac_address_table(sw_ip, sw_username, sw_password)
File "/home/sphinx/tmp/0/zabbix-map-creator/dlink.py", line 31, in get_mac_address_table
ret = t.expect(['#', 'All'])
File "/usr/lib/python2.7/dist-packages/pexpect/spawnbase.py", line 321, in expect
timeout, searchwindowsize, async)
File "/usr/lib/python2.7/dist-packages/pexpect/spawnbase.py", line 345, in expect_list
return exp.expect_loop(timeout)
File "/usr/lib/python2.7/dist-packages/pexpect/expect.py", line 107, in expect_loop
return self.timeout(e)
File "/usr/lib/python2.7/dist-packages/pexpect/expect.py", line 70, in timeout
raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f6c935c4f10>
command: /usr/bin/telnet
args: ['/usr/bin/telnet', '10.245.185.2']
buffer (last 100 chars): ' 34:08:04:e2:02:f8 1:15 dynamic\r\n304 VoIP 34:08:04:e2:03:18 1:9 dynamic\r\n'
before (last 100 chars): ' 34:08:04:e2:02:f8 1:15 dynamic\r\n304 VoIP 34:08:04:e2:03:18 1:9 dynamic\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 6141
child_fd: 5
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
0: re.compile("#")
1: re.compile("All")

Is it bug?

Получение FDB для D-Link DES-1100 с прошивкой ME

Проблема с парсером FDB таблицы от DES-1100-16/24 (ME прошивка), так как не имеет столбца VLAN. Вот вывод fdb таблицы

Port  MAC Address        Type
----  -----------------  -------  
16    90-94-E4-D5-00-05  Dynamic
16    28-3B-82-E6-90-0E  Dynamic
16    EC-22-80-6E-40-1E  Dynamic
16    5C-D9-98-9A-50-21  Dynamic
16    F8-E9-03-D1-D0-26  Dynamic
16    E8-CC-18-72-C0-28  Dynamic
16    58-D5-6E-3B-D0-30  Dynamic
16    40-9B-CD-FE-50-36  Dynamic
16    28-3B-82-E6-90-3E  Dynamic
16    14-D6-4D-04-F0-40  Dynamic
16    E8-CC-18-7C-C0-45  Dynamic
16    40-9B-CD-FE-10-46  Dynamic
16    10-62-EB-53-80-52  Dynamic
16    A0-AB-1B-FE-F0-55  Dynamic
16    F8-E9-03-D1-D0-56  Dynamic
16    E8-CC-18-6E-D0-58  Dynamic
16    9C-D6-43-5E-50-5B  Dynamic
16    58-D5-6E-3B-D0-60  Dynamic

Если можно, то добавьте пожалуйста

SSH or TELNET

Возможно доработать по какому протоколу подключаться ? Например по SSH

Problem with build_map.py

Hi,

can you help me with building map please? I try all steps and when i try to build map i have problem. If i disable zabbix in conf, script create file. When i have enable zabbix i have this exeption.

I use zabbix 4.2, centos 7

[root@hermanek-lab zabbix-map-creator]# ./arp.py test.ini
added c0:25:5c:ff:70:48 ip 192.168.248.7
added c0:25:5c:ff:65:c7 ip 192.168.248.10
added 1c:e8:5d:ff:36:46 ip 192.168.248.15
added 18:8b:45:2b:21:c7 ip 192.168.248.17
added 00:45:1d:96:2f:43 ip 192.168.248.254

!UPLINK MAC-ADDRESS MUST BE IN ARP TABLE!
[root@hermanek-lab zabbix-map-creator]# ./get_mac_form_switches.py test.ini
Connect to 192.168.248.15 , vendor cisco
Collected mac from 1 ports
After cleaning left 1 ports
192.168.248.15 added mac 00:45:1d:96:2f:43 on port Gi1/0/48
====================
Connect to 192.168.248.17 , vendor cisco
Collected mac from 1 ports
After cleaning left 1 ports
192.168.248.17 added mac 00:45:1d:96:2f:43 on port Gi1/0/48
====================
Connect to 192.168.248.10 , vendor cisco
Collected mac from 3 ports
After cleaning left 1 ports
192.168.248.10 added mac 00:45:1d:96:2f:43 on port Gi1/0/48
====================
Connect to 192.168.248.254 , vendor cisco
Collected mac from 22 ports
After cleaning left 1 ports
192.168.248.254 added mac c0:25:5c:ff:65:c7 on port Po2
192.168.248.254 added mac 18:8b:45:2b:21:c7 on port Po2
192.168.248.254 added mac c0:25:5c:ff:70:48 on port Po2
192.168.248.254 added mac 1c:e8:5d:ff:36:46 on port Po2
====================
Connect to 192.168.248.7 , vendor cisco
Collected mac from 5 ports
After cleaning left 4 ports
192.168.248.7 added mac c0:25:5c:ff:65:c7 on port Gi1/0/48
192.168.248.7 added mac 00:45:1d:96:2f:43 on port Po1
192.168.248.7 added mac 1c:e8:5d:ff:36:46 on port Gi1/0/47
192.168.248.7 added mac 18:8b:45:2b:21:c7 on port Gi1/0/46
====================
[root@hermanek-lab zabbix-map-creator]# ./build_map.py test.ini
Using configured uplink mac 00:45:1d:96:2f:43

[|] Update info about uplinks in db
[|] Check edge status of device
Traceback (most recent call last):
  File "./build_map.py", line 331, in <module>
    'selementid1': devices[eselement1]['id_on_map'],
KeyError: u'92.168.248.254'
[root@hermanek-lab zabbix-map-creator]#

Config:

[root@hermanek-lab zabbix-map-creator]# cat test.ini

[network]
; switch's default gateway mac address
uplink_mac = 0045.1d96.2f43
; switches creditionals
sw_username = cisco
sw_password = cisco
; sqlite database filename
database = test.db
; from wich file to load 'show ip arp'
arp_file_type = cisco
file_with_arp = test-cisco-show-ip-arp.txt

[zabbix]
; use zabbix.
; yes, true - build map in zabbix
; no, false - dont touch zabbix, generate only dot file with <mapname>
use_zabbix = yes
; zabbix api creditionals
username = zabbix
password = zabbix
; zabbix server url
zbx_url = http://zabbixserver/
; zabbix map to be created
mapname = TEST-NETWORK

Show ip arp

[root@hermanek-lab zabbix-map-creator]# cat test-cisco-show-ip-arp.txt
Internet  192.168.248.7          10   c025.5cff.7048  ARPA   Vlan248
Internet  192.168.248.10          4   c025.5cff.65c7  ARPA   Vlan248
Internet  192.168.248.15          4   1ce8.5dff.3646  ARPA   Vlan248
Internet  192.168.248.17         15   188b.452b.21c7  ARPA   Vlan248
Internet  192.168.248.254         -   0045.1d96.2f43  ARPA   Vlan248

Error when building map

These error we've see when try to build network map.

./build_map.py example.ini
Using configured uplink mac 00:0d:66:94:b0:00

[/] Update info about uplinks in db
[|] Check edge status of deviceUplink not found on 10.245.185.176
[/] Check edge status of deviceUplink not found on 10.245.185.166
[-] Check edge status of deviceUplink not found on 10.245.185.2
[] Check edge status of deviceUplink not found on 10.245.185.123
[|] Check edge status of deviceUplink not found on 10.245.185.29
[/] Check edge status of deviceUplink not found on 10.245.185.28

Traceback (most recent call last):
File "./build_map.py", line 261, in
min_transit_count = min(len(tmp) for tmp in all_lists) - 1
ValueError: min() arg is an empty sequence

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.