question about $agent->register in perl script

John Aldridge <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hello,

I am calling the following line in my perl module that is loaded by the
perl do line in my /etc/snmp/snmpd.conf file:

$agent->register('SERVMON-MIB',$regoid, \&my_snmp_handler);

Running snmpd through gdb I get the following results though and I was
thinking that the above register method should call
netsnmp_register_handler which would then in turn call
netsnmp_register_mib, but it doesn't seem to do this anywhere as the
D'EBUGMSGTL(("handler::register", "Registering %s (",
reginfo->handlerName));' lines aren't showing up anywhere and thus my
oid nor my mib is never getting registered.


Actually I think my handler is getting registered somewhere because at
one point that was working, but my mib is not getting registered because
it doesn't show up in the registry_dump anywhere and I can't do snmpsets
on it because it doesn't have the right reginfo->mode or something like
that.  Anyway, if anyone has anything to offer I would be very
appreciative.


perl: done initializing perl
(gdb) n
(gdb) n
(gdb) nn
Undefined command: "nn".  Try "help".
(gdb) n
trace: do_something_perlish(): snmp_perl.c, 79:
perl: calling perl
(gdb) s
starting servmon.pl
got herejohn1
trace: netsnmp_ds_set_boolean(): default_store.c, 205:
netsnmp_ds_set_boolean: Setting LIB:4 = 1/True
got herejohn
servmon.pl loaded ok
trace: netsnmp_ds_set_boolean(): default_store.c, 205:
netsnmp_ds_set_boolean: Setting LIB:13 = 1/True
trace: netsnmp_ds_set_boolean(): default_store.c, 205:
netsnmp_ds_set_boolean: Setting LIB:10 = 1/True

Breakpoint 3, netsnmp_ds_set_int (storeid=0, which=4, value=1) at
default_store.c:251
(gdb) n
(gdb) n
(gdb) n
trace: netsnmp_ds_set_int(): default_store.c, 257:
netsnmp_ds_set_int: Setting LIB:4 = 1
(gdb) n
(gdb) n
(gdb) n
0xb79c1327 in __libraries_init ()
from /usr/lib/perl5/site_perl/5.8.5/i686-linux/auto/SNMP/SNMP.so
(gdb) n
Single stepping until exit from function __libraries_init, 
which has no line number information.

Breakpoint 3, netsnmp_ds_set_int (storeid=0, which=4, value=1) at
default_store.c:251
(gdb) n
(gdb) n
(gdb) n
trace: netsnmp_ds_set_int(): default_store.c, 257:
netsnmp_ds_set_int: Setting LIB:4 = 1
(gdb) n
(gdb) n
(gdb) n
0xb79c1343 in __libraries_init ()
from /usr/lib/perl5/site_perl/5.8.5/i686-linux/auto/SNMP/SNMP.so
(gdb) n
Single stepping until exit from function __libraries_init, 
which has no line number information.
0xb79c3219 in XS_SNMP_init_snmp ()
from /usr/lib/perl5/site_perl/5.8.5/i686-linux/auto/SNMP/SNMP.so
(gdb) n
Single stepping until exit from function XS_SNMP_init_snmp, 
which has no line number information.
0xb7c326cc in Perl_pp_entersub () from /usr/lib/libperl.so.1
(gdb) n
Single stepping until exit from function Perl_pp_entersub, 
which has no line number information.
0xb7c2b457 in Perl_runops_standard () from /usr/lib/libperl.so.1
(gdb) n
Single stepping until exit from function Perl_runops_standard, 
which has no line number information.
registering at servmonMIB
running embedded within the agent.
johnhere
0xb7bd8f40 in Perl_call_sv () from /usr/lib/libperl.so.1
(gdb) n
Single stepping until exit from function Perl_call_sv, 
which has no line number information.
0xb7bd5f20 in ?? () from /usr/lib/libperl.so.1
(gdb) list
256	    DEBUGMSGTL(("netsnmp_ds_set_int", "Setting %s:%d = %d\n",
257	                stores[storeid], which, value));
258	
259	    netsnmp_ds_integers[storeid][which] = value;
260	    return SNMPERR_SUCCESS;
261	}
262	
263	int
264	netsnmp_ds_get_int(int storeid, int which)
265	{
(gdb) n
Cannot find bounds of current function
(gdb) n
Cannot find bounds of current function
(gdb) n
Cannot find bounds of current function
(gdb) n
Cannot find bounds of current function
(gdb) finish
0xb7bd92d8 in Perl_call_sv () from /usr/lib/libperl.so.1
(gdb) n
Single stepping until exit from function Perl_call_sv, 
which has no line number information.
0xb7bd5a6c in ?? () from /usr/lib/libperl.so.1
(gdb) n
Cannot find bounds of current function
(gdb) n
Cannot find bounds of current function
(gdb) finish
0xb7bd8ffd in Perl_call_sv () from /usr/lib/libperl.so.1
(gdb) finish
trace: do_something_perlish(): snmp_perl.c, 89:
perl: finished calling perl


-- 
John Aldridge <[email protected]>



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
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.