Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. SNMP > IPython and Net-SNMP

IPython and Net-SNMP

If you haven’t done any SNMP development before, you may have gotten the impression that it is a bit nasty. Well, to be honest, it is. Dealing with SNMP is a bit of a pain, as it involves a very complex protocol, lots of RFCs to read, and a high chance for many things to go wrong. One way to diminish much of the initial pain of getting started with development is to use IPython to explore the SNMP code you will write and to get comfortable with the API.

Example 7-1 is a very brief snippet of live code to run on a local machine.

Example 7-1. Using IPython and Net-SNMP with Python bindings
In [1]: import netsnmp
            
In [2]: oid= netsnmp.Varbind('sysDescr')
            
        
In [3]: result = netsnmp.snmpwalk(oid,
...:                         Version = 2,
...:                         DestHost="localhost",
...:                         Community="public")

Out[4]: ('Linux localhost 2.6.18-8.1.14.el5 #1 SMP Thu Aug 27 12:51:54 EDT 2008 i686',)

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint