OT: query routers tables

Mogens Kjaer mk at crc.dk
Wed Jan 3 14:47:48 UTC 2007


Jamie Bohr wrote:
> This question is way off topic, sorry.  I have googled and googled and have
> not come up with a answer to my question.
> 
> I want to query a switch (via SNMP I think) to get a list of systems
> attached to it.  I am using Nagios and would like to determine 
> switch/router
> dependencies.  Trace route will not work because it will not show
> routers/switches for systems on the same sub-net as the system doing the
> trace route and I have seen where it does not return the network based
> switch a system is attached to, just the router.  If I could get a list
> systems attached to a router/switch (not a personnel switch, a managed
> switch) I can correlate the information and build dependencies.  I have a
> hand-held Fluke network tester than runs Linux that will do this for me 
> when
> I type in a hostname, I would rather do it programmaticly because I have
> over 300 systems I need to do.  I am open to any method that works that I
> can script so I don't have to do it every time a new system appears.  Just
> in case it matters some systems are attached to a V-lan off a managed 
> switch
> and I do NOT have admin rights to the routers or switches.
> 

I wrote a C program that uses SNMP for this.

It queries the switches and hubs for the MAC addresses
seen at each port and the number of bytes in/out.

Some switches have a MAC to IP table, else I would
ask the ARP table of the router for a table like this.

The program then prepares a nice top-10 on the
intraweb showing which computers are generating
most traffic, and another table with traffic
at each switch/hub port.

This program was made by studying the output from
snmpwalk for the switches, finding the necessary
MIB's etc.

The program is unreadable by anyone else
but me, so it is not suitable for distribution, but
maybe this could give you a hint on how to proceed.

Mogens

-- 
Mogens Kjaer, Carlsberg A/S, Computer Department
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Fax: +45 33 27 47 08
Email: mk at crc.dk Homepage: http://www.crc.dk




More information about the fedora-list mailing list