This is a bug in the perl script.  It does a "poor-man's" lexicographical
ordering, only handling objects that it knows about.  This works for a
walk, but does not work for the (valid) request that snmptable makes.

The easiest fix would be for the agent to learn that
$next_oid{netSnmpIETFWGEntry.0}
= $next_oid{netSnmpIETFWGTable}.

The proper fix would be to teach the agent lexicographical ordering and
allow it to respond to any getnext with the actual next object.

  Bill



On Mon, Aug 4, 2014 at 1:52 PM, mar work <rana2w...@gmail.com> wrote:

> Hi:
>
> Well first of all thanks for taking a look into this, my main problem is
> that I'm looking forward to get an agent to display the information in a
> table mode with snmptable command,
> other examples I have seen do parse the output of a table, and other
> issues I found where the table wasn't working the walk either, but this is
> not the case, maybe there
> is an answer for this issue somewhere but I was unable to find it.
>
> So here I have the example of the agent shown in Tut:Extending snmpd using
> perl, I changed it to use the MIB from NET-SNMP-EXAMPLES-MIB, I'm Able to
> walk the agent but the table just says no entries, I set it on debugging
> mode, and tries to get netSnmpIETFWGEntry.0 and there is nothing there,
> so I would like to know Is there something wrong with the OID's of what am
> I doing wrong??
>
>
> #IM USING THE AGENT FROM
>
> http://www.net-snmp.org/wiki/index.php/Tut:Extending_snmpd_using_perl#.22Code.22_:_perl_do
>
> $ snmptable -v2c -c public localhost
> NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable
> No log handling enabled - turning on stderr logging
> /usr/share/snmp/snmp_perl.pl @ netSnmpIETFWGEntry.0  GETNEXT Hit by a
> truck whilst walking ...
> NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable: No entries
>
> $ snmpwalk -v2c -c public localhost
> NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable
> /usr/share/snmp/snmp_perl.pl @ netSnmpIETFWGTable  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.1 = STRING: "root"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGName.1  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.2 = STRING: "x"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGName.2  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.3 = STRING: "0"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGName.3  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.1 = STRING: "0"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair1.1  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.2 = STRING: "root"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair1.2  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.3 = STRING: "/root"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair1.3  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.1 = STRING: "/bin/bash"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair2.1  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.2 = STRING: "bin"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair2.2  GETNEXT
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.3 = STRING: "x"
> /usr/share/snmp/snmp_perl.pl @ nsIETFWGChair2.3  GETNEXT Hit by a truck
> whilst walking ...
>
> $ snmpwalk -v2c -c public localhost
> NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.1 = STRING: "root"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.2 = STRING: "x"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGName.3 = STRING: "0"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.1 = STRING: "0"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.2 = STRING: "root"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair1.3 = STRING: "/root"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.1 = STRING: "/bin/bash"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.2 = STRING: "bin"
> NET-SNMP-EXAMPLES-MIB::nsIETFWGChair2.3 = STRING: "x"
>
> $ snmptranslate -On NET-SNMP-EXAMPLES-MIB::netSnmpIETFWGTable
> .1.3.6.1.4.1.8072.2.2.1
>
> #HERE IS MY SNMPD.CONF FILE
> com2sec local     localhost           public
> com2sec miredlocal 100.100.0.0/16     public
> #Se asigna local al grupo de lectura escritura
> group MyRWGroup v1 local
> group MyRWGroup v2c local
> group MyRWGroup usm local
>
> #Se asigna miredlocal al grupo de solo lectura
> group MyROGroup v1 miredlocal
> group MyROGroup v2c miredlocal
> group MyROGroup usm miredlocal
> # name   incl/excl subtree   mask(optional)
> view all  included  .1        80
>
> # group         context  sec.model sec.level prefix read   write notif
> access MyROGroup ""       any       noauth    exact  all    none  none
> access MyRWGroup ""       any       noauth    exact  all    all   all
>
> #syslocation Servidor Linux en SU-SERVIDOR.algun-dominio.net
> syscontact Administrador (c...@etcsnmp.net)
> syslocation vmracnode1
>
> #to recognize system drives
> includeAllDisks 1
>
> #perl
> perl $debugging = '1';
> #perl $verbose = '1';
> perl {$regat = '.1.3.6.1.4.1.8072.2.2.1'; $extension = '1'; $mibdata =
> '/home/me/text.txt'; $delimT=''; $delimV=':'; do '/etc/snmp/snmpagent.pl
> ';}
>
> #HERE IS THE TEXT INPUT
> root:x:0
> 0:root:/root
> /bin/bash:bin:x
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Net-snmp-coders mailing list
> Net-snmp-coders@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>
>
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to