Router Monitoring method?
Eddie Corns
eddie at holyrood.ed.ac.uk
Wed Aug 28 13:03:20 EDT 2002
mhbaek at korea.com (mhbaek) writes:
>Hi everyone ^^
>I want to programing router moniter.
>1)connect cicsco 8 router
>2)show NAT table (# show ip nat translations)
>3)search of a IP Address
>you send me to a good idea
>Thank you.
You have 2 choices:
1) Get one of the SNMP packages for Python and query the NAT MIB
2) Create a small program using the Python telnet library
Option 1 is probably the most efficient and robust but also probably a lot
more work if you're not familiar with SNMP and MIBs. There are at least 3
SNMP packages available but I'm not going to recommend any of them because I'm
not sure if I like any of them yet. Use Google to search for Pysnmp, yapsnmp
and pynms.
I have a couple of small programs I use for sending commands to Cisco
routers with telnet. There is a class to deal with most of the work of
setting up the connection and logging in. It is specific to our needs but
probably wouldn't take too much work to adapt. I'll send you the code if
you're interested (there is no documentation).
You don't say what you mean by 'search for IP Address', most modern versions of
Cisco CLI have a builtin way of searching through the output, for example:
router> sho ip nat translations | include REGEX
this can cut down on the amount of work you need to do.
Eddie
More information about the Python-list
mailing list