Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

network discover and report

by itsd2001 (Initiate)
on Apr 02, 2004 at 02:33 UTC ( #341870=perlquestion: print w/replies, xml ) Need Help??
itsd2001 has asked for the wisdom of the Perl Monks concerning the following question:

I am new Perl, Please be patient with me
I would like to write perl script that need to do:
1) Discover all Cisco Switches on the Network not other devices
2) Query all the cisco switches found in 1) and see how many connected port are 10Mbps, how many are 100Mbps and how many are Gigabit
3) Generate a report that show:
Switch name 10Mbps 100Mbps 1Gbps
Is this can be done with easly with perl, If yes I realy need some advise how to start this.
Many thanks

Replies are listed 'Best First'.
Re: network discover and report
by PodMaster (Abbot) on Apr 02, 2004 at 03:15 UTC
Re: network discover and report
by tachyon (Chancellor) on Apr 02, 2004 at 03:26 UTC

    Net::SNMP is probably a good place to start. If you search CPAN for 'Cisco' you will find lots of stuff.



Re: network discover and report
by DigitalKitty (Parson) on Apr 02, 2004 at 06:01 UTC
Re: network discover and report
by bronto (Priest) on Apr 02, 2004 at 12:24 UTC

    nmap does it. But if you need a custom solution you can run many ways. I'll give you two of them

    If you already know the address of the Cisco devices, just point nmap to them, get its output (e.g., the XML one) and parse it with one of the many perl modules around (e.g.: XML::Twig)

    If you don't know the addresses, well, scan the whole network, get an XML output, select the cisco devices and work on them

    You could also generate a report directly from the NMAP XML output using, for example, XML::XPathScript.

    Good luck!


    The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
    --John M. Dlugosz
Re: network discover and report (existing Cisco scripts onsite)
by ybiC (Prior) on Apr 02, 2004 at 15:34 UTC
Re: network discover and report
by iwanthome (Beadle) on Apr 02, 2004 at 03:09 UTC
    I'm newbie too. 1)I don't know how to discover.I think you must get a seed device at least.Then you can get any other switch or router which connected to this switch via cdp. 2)It can be done by net::snmp,you can do it by get status of the interface via oid.
Re: network discover and report
by McMahon (Chaplain) on Apr 02, 2004 at 14:58 UTC
    You might also want to invest in the book Network Programming With Perl by Lincoln Stein. There's all sorts of good example code (with great explanations) that should give you ideas about how to proceed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://341870]
Approved by Paladin
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2018-07-17 18:04 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (374 votes). Check out past polls.