pysnmp/shell

Discussion in 'Python' started by Axel Scheepers, Jun 22, 2004.

  1. Hi All,

    Python is so great. I've been creating a small set of objects to get some
    stats from our adsl routers. So far it works great and fast. However, in the
    shell script I created over a year ago to gather stats I do:

    mib_lp=`$snmpwalk $ip_address public
    ip.ipAddrTable.ipAddrEntry.ipAdEntIf
    Index 2>/dev/null | $grep " = $lan_iface" | $head -1 | $sed -E
    's/^ip.ipAddrTabl
    e.ipAddrEntry.ipAdEntIfIndex.(.+) = .*/\1/g'`
    if [ "$mib_lp" != "" ]; then
    lan_ip=`$snmpget $ip_address public
    ip.ipAddrTable.ipAddrEntry.ipAdEntA
    ddr.$mib_lp 2>/dev/null | $sed -E 's/.+IpAddress: //g'`
    lan_netmask=`$snmpget $ip_address public
    ip.ipAddrTable.ipAddrEntry.ipA
    dEntNetMask.$mib_lp 2>/dev/null| $sed -E 's/.+IpAddress: //g'`
    else
    lan_ip="ERROR"
    lan_netmask="ERROR"
    fi

    To retrieve the lan settings for the router. I don't know the (lan)ip
    address of it but do know the interface number, that's why I check for that
    and then use a part of the mib to get to the netmask.

    This seems to be quite difficult with pysnmp (took me half an hour to write
    Router.SNMPQuery(self, noid) ;-)), so before I get started I wanted to ask
    if somebody might have better idea for this.

    Thanks!
    Kind regards,
    Axel Scheepers
     
    Axel Scheepers, Jun 22, 2004
    #1
    1. Advertising

  2. Oh damn.
    Sorry for the multiple posts, that was _not_ on purpose.

    Sorry!
    Kind regards,
    Axel Scheepers
     
    Axel Scheepers, Jun 22, 2004
    #2
    1. Advertising

  3. Axel Scheepers

    Peter Hansen Guest

    Axel Scheepers wrote:

    > Oh damn.
    > Sorry for the multiple posts, that was _not_ on purpose.
    >
    > Sorry!


    Judging by the new text at the top of the python.org web site,
    this is not likely your fault. (And I've seen several other
    repeates just now.)

    """python.org mail system is sick
    Yes, we know about it. Yes, we're working on it.
    Please don't bug us; we'll get the work done faster. ;-)
    """


    -Peter
     
    Peter Hansen, Jun 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. WIWA

    pySNMP: SNMPget example

    WIWA, Jul 10, 2003, in forum: Python
    Replies:
    3
    Views:
    6,147
    Ilya Etingof
    Jul 16, 2003
  2. WIWA

    pySNMP: SNMP walk

    WIWA, Aug 21, 2003, in forum: Python
    Replies:
    0
    Views:
    2,108
  3. Axel Scheepers

    pysnmp/shell

    Axel Scheepers, Jun 22, 2004, in forum: Python
    Replies:
    2
    Views:
    559
    Ilya Etingof
    Jun 25, 2004
  4. Axel Scheepers

    pysnmp/shell

    Axel Scheepers, Jun 22, 2004, in forum: Python
    Replies:
    0
    Views:
    382
    Axel Scheepers
    Jun 22, 2004
  5. Axel Scheepers

    pysnmp/shell

    Axel Scheepers, Jun 22, 2004, in forum: Python
    Replies:
    0
    Views:
    409
    Axel Scheepers
    Jun 22, 2004
Loading...

Share This Page