Re: python module for netsnmp

"Andreea Bogdana Botez" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi Dave,

See my answers below.

Q: > What happens if you try a "snmpget" request with the same numeric OID?
> Does that return a value or not?

A: I've just checked - it returns None:
In [15]: oid = netsnmp.Varbind(<numeric_OID_here>,'0')
In [19]: netsnmp.snmpget(oid, Version=2, RemotePort=8333, Community="private")
Out[19]: (None,)

Q: > What happens if you try the python code with a "standard" OID?
> Does that work or not?

A: This works - for example the script below works fine:
       sess = netsnmp.Session(Version=2,  DestHost='localhost',
Community='public')

       sess.UseEnums = 1
       sess.UseLongNames = 1

       vars = netsnmp.VarList(netsnmp.Varbind('sysUpTime', 0),
                              netsnmp.Varbind('sysContact', 0),
                              netsnmp.Varbind('sysLocation', 0))
       vals = sess.get(vars)


Bogdana


On 4/16/07, Dave Shield <[email protected]> wrote:
> On 16/04/07, Andreea Bogdana Botez <[email protected]> wrote:
> > But, when I try to do the same think using the python module:
> >
> >        sess = netsnmp.Session(Version=2, DestHost='localhost',
> > Community='public')
> >        sess.UseEnums = 1
> >        sess.UseLongNames = 1
> >        vars = netsnmp.VarList(netsnmp.Varbind(<oid>,'0'))
> >        vals = sess.get(vars)
> >
> > I get an "get: unknown object ID (<oid>)v2 sess.get result:  None" error.
> >
> > If I change vars = netsnmp.VarList(netsnmp.Varbind(<numeric_oid>,'0')) -
> > then I get a None object in vals.
>
> What happens if you try a "snmpget" request with the same numeric OID?
> Does that return a value or not?
>
> What happens if you try the python code with a "standard" OID?
> Does that work or not?
>
> Dave
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.