This is a discussion on gettable method broken or limited ? within the SNMP Users forums, part of the Networking and Network Related category; This is a multi-part message in MIME format. ------_=_NextPart_001_01C67DF2.13AD4625 Content-Type: text/plain; charset="us-ascii&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
This is a multi-part message in MIME format.
------_=_NextPart_001_01C67DF2.13AD4625 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have been trying to get the gettable method working with no success (sort of). I am trying to get at a table in the Cisco class based qos mib using gettable with no success. All I get is the following error... =20 C:\Perl>perl testthis.pl Cannot find module: At line 1 in (none) STORE(SNMP::MIB=3DHASH(0x19fb740) enterprises.9.9.166.1.1.1 HASH(0x1a4c44c)) : write access to the MIB not implemented Modification of non-creatable array value attempted, subscript -1 at C:/Perl/site/lib/SNMP.pm line 694. =20 The code is simple and basically straight from the man page =20 #!/usr/bin/perl use SNMP; use Data::Dumper; use strict; #my $mib=3D'CISCO-CLASS-BASED-QOS-MIB'; my $mibs=3D'ALL'; &SNMP::loadModules(my $mibs); my $hostname=3D"xxx.xxx.xxx.xxx"; my $comm=3D"somename"; my $port=3D"161"; =20 my $sess =3D new SNMP::Session( 'DestHost' =3D> $hostname, 'Community' =3D> $comm, 'RemotePort' =3D> $port, 'Timeout' =3D> 5000000, 'Version' =3D> '2',); die "Cannot create session: ${SNMP::ErrorStr}\n" unless defined $sess; print Dumper($sess->gettable('1.3.6.1.4.1.9.9.166.1.1.1')); =20 If I substitute the above oid for "ifTable" or its oid, the results are as expected. If I use the command line "SNMPTABLE" on the same device and oid, the results are as I would expect. =20 Is it my poor code or gettable/SNMP.PM ? =20 Thanks in advance Peter Fitz ------_=_NextPart_001_01C67DF2.13AD4625 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:o=3D"urn:schemas-microsoft-com:office:office" = xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt;} div.Section1 {page:Section1;} --> </style> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>I have been trying to get the gettable method working = with no success (sort of).<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>I am trying to get at a table in the Cisco class = based qos mib using gettable with no success.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>All I get is the following = error…<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>C:\Perl>perl = testthis.pl<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Cannot find module: At line 1 in = (none)<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>STORE(SNMP::MIB=3DHASH(0x19fb740) = enterprises.9.9.166.1.1.1 HASH(0x1a4c44c)) : write access to the MIB not = implemented<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Modification of non-creatable array value attempted, subscript -1 at C:/Perl/site/lib/SNMP.pm line = 694.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>The code is simple and basically straight from the = man page<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>#!/usr/bin/perl<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> use SNMP;<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> use Data::Dumper;<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> use strict;<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> #my = $mib=3D'CISCO-CLASS-BASED-QOS-MIB';<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> my $mibs=3D'ALL';<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> &SNMP::loadModules(my = $mibs);<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> my = $hostname=3D"xxx.xxx.xxx.xxx";<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> my = $comm=3D"somename";<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> my = $port=3D"161";<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> <o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> my $sess =3D new SNMP::Session( = 'DestHost' =3D> $hostname,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> = &n bsp; &= nbsp; &n bsp; = 'Community' =3D> $comm,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> = &n bsp; &= nbsp; &nb sp; &n= bsp; &nbs p; = 'RemotePort' =3D> $port,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> = &n bsp; &= nbsp; &nb sp; = 'Timeout' =3D> 5000000,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> = &n bsp; &= nbsp; &nb sp; = 'Version'   ; = =3D> '2',);<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> die "Cannot create session: ${SNMP::ErrorStr}\n" unless defined = $sess;<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'> print Dumper($sess->gettable('1.3.6.1.4.1.9.9.166.1.1.1'));<o:p ></o:p></span= ></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>If I substitute the above oid for = “ifTable” or its oid, the results are as expected.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>If I use the command line “SNMPTABLE” on = the same device and oid, the results are as I would = expect.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Is it my poor code or gettable/SNMP.PM = ?<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Thanks in advance<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span = style=3D'font-size:10.0pt; font-family:Arial'>Peter Fitz<o:p></o:p></span></font></p> </div> </body> </html> ------_=_NextPart_001_01C67DF2.13AD4625-- ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=...057&dat=121642 _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/...net-snmp-users |