newbie question: snmp support for Python

Dave dave at focaleng.net
Wed Jan 30 15:04:29 EST 2002


Pierre Rouleau wrote:

> 
> Question:  is SNMP currently supported in the Python Library distributed
> with Python 2.2?
> 
> 
> Thanks
> 
> 
> Pierre Rouleau
> 

Answer: No.

Qualifier: PySNMP now look like it is in usable form, so SNMP v1 support 
is only an import away.

Argument: But I want/need more functionality than v1 can provide!

Retort: If that's the case, here's what I do (works on UNIX, I don't 
know of a command line snmp suite for Win32). Install the net-snmp 
package and try something like this:

 >>> import os
 >>> indexlist = []
 >>> list = ['router1', 'switch1', etc]
 >>> community_string = 'foo'
 >>> for devicename in list:
...         list_up_ifs = os.popen("snmpbulkwalk -v 2c %s %s 
interfaces.ifTable.ifEntry.ifOperStatus |grep up" % (devicename, 
community_string)).readlines()


The above would give a list of the index numbers for all up interfaces 
on whatever you were querying, while using v2.

Best,
Dave



-----=  Posted via Newsfeeds.Com, Uncensored Usenet News  =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
 Check out our new Unlimited Server. No Download or Time Limits!
-----==  Over 80,000 Newsgroups - 19 Different Servers!  ==-----



More information about the Python-list mailing list