snmp coding examples

Raaijmakers, Vincent (IndSys, GE Interlogix) Vincent.Raaijmakers at ge.com
Tue Dec 31 09:57:33 EST 2002


Thanks!!

Appreciate.

Vincent

-----Original Message-----
From: Scherer, Bill [mailto:Bill.Scherer at verizonwireless.com]
Sent: Tuesday, December 31, 2002 8:49 AM
To: Raaijmakers, Vincent (IndSys, GE Interlogix)
Cc: python-list at python.org
Subject: RE: snmp coding examples



[Posted & Mailed]

On Tue, 31 Dec 2002, Raaijmakers, Vincent (IndSys, GE Interlogix) wrote:

> Yes, I tried google. 
> Just need an example that returns for me the memory and cpu usage of a linux box using snmp/python
> My hope was that some existing examples would help me in skipping the detailed world of MIB's, v1 and v2's..
> 

Python 2.2.2 (#1, Oct 15 2002, 13:18:41)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-110)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> host = 'myhost.mycorp.com'
>>> community = 'nice'
>>> from snmpget import snmpget
>>> memAvailSwap_0 = ".1.3.6.1.4.1.2021.4.4.0"
>>> load_1 = ".1.3.6.1.4.1.2021.10.1.3.1"
>>> oids = (memAvailSwap_0, load_1)
>>> getter = snmpget(host, community)
>>> objids, values = getter.run(oids)
>>> values
[('INTEGER', 1047956L), ('OCTETSTRING', '0.00')]
>>>

   
snmpget comes with pysnmp (http://pysnmp.sourceforge.net/).

Use snmpwalk and friends from netsnmp (or equivalent) to get a
list of available oids and to translate the symbolic names to
the dotted notation required by pysnmp.

Hope that helps,

Bill


> After a couple of hours I lost my hope.

Don't give up so easy!

> 
> Vincent
> 
> -----Original Message-----
> From: Peter Wu [mailto:peterwu at hotmail.com]
> Sent: Tuesday, December 31, 2002 12:32 AM
> To: python-list at python.org
> Subject: Re: snmp coding examples
> 
> 
> In article <mailman.1041305539.14460.python-list at python.org>,
> Raaijmakers, Vincent (IndSys, GE Interlogix) wrote:
> 
> > can someone help me please in getting me started with snmp.
> > I try to start with pysnmp but like to have some python examples how
> > I can use it to monitor for example CPU usage.
> >
> > Any help, references to code and/or tips would be highly appreciated.
> 
> Have you searched Google for SNMP?
> 
> --
> Cheers, Peter





More information about the Python-list mailing list