Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > pysnmp/shell

Reply
Thread Tools

pysnmp/shell

 
 
Axel Scheepers
Guest
Posts: n/a
 
      06-22-2004
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


 
Reply With Quote
 
 
 
 
Axel Scheepers
Guest
Posts: n/a
 
      06-22-2004
Oh damn.
Sorry for the multiple posts, that was _not_ on purpose.

Sorry!
Kind regards,
Axel Scheepers


 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      06-22-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments