This is a discussion on Re: 5.4.1 won't talk within the SNMP Coders forums, part of the Networking and Network Related category; --===============0008042677== Content-Type: multipart/alternative; boundary="----=_Part_7285_23847028.1208367335329" ------=_Part_7285_23847028.1208367335329 Content-Type: text/plain; charset=ISO-8859-1 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
--===============0008042677==
Content-Type: multipart/alternative; boundary="----=_Part_7285_23847028.1208367335329" ------=_Part_7285_23847028.1208367335329 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Magnus and Dave, I'm following Magnus's advice and running with -Dtdomain, and here is the result. The first three files are our standard snmpd.conf and the agent and subagent output redirected; the next three are after I took out the "perl do" line, which I do not understand the need of, and it eliminated the Bareword diagnostic, but still no go. The last file is a snippet of the key part of the subagent code. Note that in no case does it ever get past $agent->agent_check_and_process - even though in each case I made a snmpget and/or snmpgetnext call (note Connection from UDP lines). There is nowhere any hint that the agent has learned about our subtree (22782), even though we call "my $regoid = new NetSNMP::OID('.1.3.6.1.4.1.22782')" and later register the subagent. Larry :::::::::::::: snmpd.conf-old :::::::::::::: #version 1 rocommunity public rwcommunity private master agentx agentXSocket /var/agentx/master perl do /etc/edgeware-subagent.pl :::::::::::::: Dtdomain.out :::::::::::::: No log handling enabled - turning on stderr logging registered debug token tdomain, 1 netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() tdomain: netsnmp_tdomain_init() called tdomain: domain_list -> { iso.3.6.1.6.1.1, "udp" } -> { iso.3.6.1.2.1.100.1.5, "tcp" } -> { iso.3.6.1.2.1.100.1.13, "unix" } -> { iso.3.6.1.2.1.100.1.2, "udp6/ipv6/udpv6/udpipv6" } -> { iso.3.6.1.2.1.100.1.6, "tcp6/tcpv6/tcpipv6" } -> [NIL] Turning on AgentX master support. Bareword found where operator expected at (eval 2) line 1, near "/etc/edgeware" (Missing operator before edgeware?) NET-SNMP version 5.4.1 Connection from UDP: [127.0.0.1]:32775 :::::::::::::: subagent.out :::::::::::::: 286 keys found in ordered_leaf_oids after get_in_order_oids call. 339 = size of oids_chomp; 339 size of next_leaf_str. ..1.3.6.1.4.1.22782 (cuttedge) = first oid; .1.3.6.1.4.1.22782.1.1.1 (productType) = first leaf. perl_module.pl loaded ok registering at cuttedge netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() started us as a subagent (NetSNMP::agent=HASH(0x1182030)) BEFORE registration at cuttedge AFTER registration at cuttedge Yes I am a subagent approaching running loop. :::::::::::::: snmpd.conf :::::::::::::: #version 1 rocommunity public rwcommunity private master agentx agentXSocket /var/agentx/master :::::::::::::: Dtdomain2.out :::::::::::::: No log handling enabled - turning on stderr logging registered debug token tdomain, 1 netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() tdomain: netsnmp_tdomain_init() called tdomain: domain_list -> { iso.3.6.1.6.1.1, "udp" } -> { iso.3.6.1.2.1.100.1.5, "tcp" } -> { iso.3.6.1.2.1.100.1.13, "unix" } -> { iso.3.6.1.2.1.100.1.2, "udp6/ipv6/udpv6/udpipv6" } -> { iso.3.6.1.2.1.100.1.6, "tcp6/tcpv6/tcpipv6" } -> [NIL] Turning on AgentX master support. tdomain: tdomain_transport_full("agentx", "/var/agentx/master", 1, "[NIL]", "[NIL]") tdomain: Address starts with '/', so assume "unix" domain tdomain: Found domain "unix" from specifier "unix" tdomain: domain "unix" address "/var/agentx/master" default address "/var/agentx/master" tdomain: tdomain_transport_full("snmp", "", 1, "[NIL]", "[NIL]") tdomain: Use application default domain "udp" tdomain: Found domain "udp" from specifier "udp" tdomain: domain "udp" address "" default address ":161" NET-SNMP version 5.4.1 Connection from UDP: [127.0.0.1]:32775 Connection from UDP: [127.0.0.1]:32775 :::::::::::::: subagent2.out :::::::::::::: 286 keys found in ordered_leaf_oids after get_in_order_oids call. 339 = size of oids_chomp; 339 size of next_leaf_str. ..1.3.6.1.4.1.22782 (cuttedge) = first oid; .1.3.6.1.4.1.22782.1.1.1 (productType) = first leaf. perl_module.pl loaded ok registering at cuttedge netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load() started us as a subagent (NetSNMP::agent=HASH(0x1182030)) BEFORE registration at cuttedge AFTER registration at cuttedge Yes I am a subagent approaching running loop. :::::::::::::: sasnip.pl :::::::::::::: BEGIN { if ($DEBUG) { print STDERR "starting perl_module.pl\n"; } } use NetSNMP::OID (':all'); use NetSNMP::agent (':all'); use NetSNMP::ASN (':all'); if ($DEBUG) { print STDERR "perl_module.pl loaded ok\n"; } # set to 1 to get extra debugging information $debugging = 1; # if we're not embedded, this will get auto-set below to 1 $subagent = 1; # where we are going to hook onto my $regoid = new NetSNMP::OID('.1.3.6.1.4.1.22782'); if ($DEBUG) { print STDERR "registering at ", $regoid, "\n" if ($debugging); } # If we're not running embedded within the agent, then try to start # our own subagent instead. if ( !$agent ) { $agent = new NetSNMP::agent( 'Name' => 'test', # reads test.conf 'AgentX' => 1 ); # make us a subagent $subagent = 1; if ($DEBUG) { print STDERR "started us as a subagent ($agent)\n"; } } # we register ourselves with the master agent we're embedded in. The # global $agent variable is how we do this: print STDERR "BEFORE registration at $regoid\n" if ($DEBUG); $agent->register( 'myname', $regoid, \&my_snmp_handler ); print STDERR "AFTER registration at $regoid\n" if ($DEBUG); if ($subagent) { my $firstrun = 1; print STDERR "Yes I am a subagent approaching running loop.\n" if ($DEBUG); # We need to perform a loop here waiting for snmp requests. We # aren't doing anything else here, but we could. $SIG{'INT'} = \&shut_it_down; $SIG{'QUIT'} = \&shut_it_down; $running = 1; while ($running) { $agent->agent_check_and_process(1); # 1 = block if ($firstrun) { print STDERR "Got past agent_check_and_process once.\n" if ($DEBUG); $firstrun = 0; } print STDERR ":" if ($DEBUG); } $agent->shutdown(); } On 4/16/08, Larry Dickson <ldickson@cuttedge.com> wrote: > > Good call, Dave: I put the line in snmpd.conf and restarted. Everything > came up happily (and I noticed that /var/agentx/master exists as a socket, > where even the directory /var/agentx had not existed before). For some > reason it is behaving as if the subagent is not there, i.e. skipping over > our subtree when I do a "getnext". But I expect I can turn on DEBUG in the > subagent and track it down. If not, I'll get back to you... > > Thanks, > > Larry > > On 4/16/08, Dave Shield <D.T.Shield@liverpool.ac.uk> wrote: > > > > On 15/04/2008, Larry Dickson <ldickson@cuttedge.com> wrote: > > > netsnmp_assert !"registration != duplicate" failed > > > agent_registry.c:535 netsnmp_subtree_load() > > > netsnmp_assert !"registration != duplicate" failed > > > agent_registry.c:535 netsnmp_subtree_load() > > > netsnmp_assert !"registration != duplicate" failed > > > agent_registry.c:535 netsnmp_subtree_load() > > > > You can ignore those - they're harmless. > > > > > > > Turning on AgentX master support. > > > Error: Couldn't open a master agentx socket to listen on (): > > > > Who are you running this agent as? Root, or a different user? > > > > Do you have an "agentXSocket" directive in your snmpd.conf file? > > What AgentX-related config settings do you have? > > > > Does the directory /var/agentx exist before you start the agent? > > What about the socket /var/agentx/master > > (both before and after starting the agent). > > > > > > > This means agentx_sockets = > > > strdup(netsnmp_get_string(NETSNMP_DS_APPLICATION_I D, > > > NETSNMP_DS_AGENT_X_SOCKET)) returned nothing > > > > That's normal. > > This is the mechanism for overriding the default AgentX socket > > (either via the 'AgentXSocket' config directive, or the -x command > > line option). > > > > > > The issue actually lies with setting the default value (a few lines > > later). > > This changed from > > agentx_sockets = strdup( {NETSNMP_}AGENTX_SOCKET ); > > > > in the 5.2.x and 5.3.x lines, and is now > > agentx_sockets = strdup( "" ); > > > > This was part of SVN revision 15258, aimed at introducing a > > more flexible transport creation mechanism. It may be that > > this has broken (or changed) the default AgentX behaviour. > > > > A simple workaround would be to specify the AgentX port > > explicitly - either in the snmpd.conf file > > > > agentXSocket /var/agentx/master > > > > or on the command line > > > > snmpd -x /var/agentx/master ..... > > > > Dave > > > > ------=_Part_7285_23847028.1208367335329 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline <div> </div> <div>Hi Magnus and Dave,</div> <div> </div> <div>I'm following Magnus's advice and running with -Dtdomain, and here is the result. The first three files are our standard snmpd.conf and the agent and subagent output redirected; the next three are after I took out the "perl do" line, which I do not understand the need of, and it eliminated the Bareword diagnostic, but still no go. The last file is a snippet of the key part of the subagent code. Note that in no case does it ever get past $agent->agent_check_and_process - even though in each case I made a snmpget and/or snmpgetnext call (note Connection from UDP lines).</div> <div> </div> <div>There is nowhere any hint that the agent has learned about our subtree (22782), even though we call "my $regoid = new NetSNMP::OID('.1.3.6.1.4.1.22782')" and later register the subagent.</div> <div> </div> <div>Larry</div> <div> </div> <div>::::::::::::::<br>snmpd.conf-old<br>::::::::::::::<br>#version 1<br>rocomm unity public<br>rwcommunity private<br>m aster agentx<br>agentXSocket /var/agentx/master<br>perl do /etc/edgeware-subagent.pl<br>::::::::::::::<br> Dtdomain.out<br>::::::::::::::<br>No log handling enabled - turning on stderr logging<br>registered debug token tdomain, 1<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br> netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>tdomain: netsnmp_tdomain_init() called<br> tdomain: domain_list -> { iso.3.6.1.6.1.1, "udp" } -> { iso.3.6.1.2.1.100.1.5, "tcp" } -> { iso.3.6.1.2.1.100.1.13, "unix" } -> { iso.3.6.1.2.1.100.1.2, "udp6/ipv6/udpv6/udpipv6" } -> { iso.3.6.1.2.1.100.1.6, "tcp6/tcpv6/tcpipv6" } -> [NIL]<br> Turning on AgentX master support.<br>Bareword found where operator expected at (eval 2) line 1, near "/etc/edgeware"<br> (Missing operator before edgeware?)<br>NET-SNMP version 5.4.1<br>Connection from UDP: [127.0.0.1]:32775<br> ::::::::::::::<br>subagent.out<br>::::::::::::::<b r>286 keys found in ordered_leaf_oids after get_in_order_oids call.<br>339 = size of oids_chomp; 339 size of next_leaf_str.<br>.1.3.6.1.4.1.22782 (cuttedge) = first oid; .1.3.6.1.4.1.22782.1.1.1 (productType) = first leaf.<br> perl_module.pl loaded ok<br>registering at cuttedge<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br> netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>started us as a subagent (NetSNMP::agent=HASH(0x1182030))<br>BEFORE registration at cuttedge<br>AFTER registration at cuttedge<br> Yes I am a subagent approaching running loop.<br>::::::::::::::<br>snmpd.conf<br>::::::::: :::::<br>#version 1<br>rocommunity publi c<br>rwcommunity private<br>master agent x<br>agentXSocket /var/agentx/master<br>::::::::::::::<br> Dtdomain2.out<br>::::::::::::::<br>No log handling enabled - turning on stderr logging<br>registered debug token tdomain, 1<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br> netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>tdomain: netsnmp_tdomain_init() called<br> tdomain: domain_list -> { iso.3.6.1.6.1.1, "udp" } -> { iso.3.6.1.2.1.100.1.5, "tcp" } -> { iso.3.6.1.2.1.100.1.13, "unix" } -> { iso.3.6.1.2.1.100.1.2, "udp6/ipv6/udpv6/udpipv6" } -> { iso.3.6.1.2.1.100.1.6, "tcp6/tcpv6/tcpipv6" } -> [NIL]<br> Turning on AgentX master support.<br>tdomain: tdomain_transport_full("agentx", "/var/agentx/master", 1, "[NIL]", "[NIL]")<br>tdomain: Address starts with '/', so assume "unix" domain<br> tdomain: Found domain "unix" from specifier "unix"<br>tdomain: domain "unix" address "/var/agentx/master" default address "/var/agentx/master"<br>tdomain: tdomain_transport_full("snmp", "", 1, "[NIL]", "[NIL]")<br> tdomain: Use application default domain "udp"<br>tdomain: Found domain "udp" from specifier "udp"<br>tdomain: domain "udp" address "" default address ":161"<br>NET-SNMP version 5.4.1<br> Connection from UDP: [127.0.0.1]:32775<br>Connection from UDP: [127.0.0.1]:32775<br>::::::::::::::<br>subagent2.out<br>::::: :::::::::<br>286 keys found in ordered_leaf_oids after get_in_order_oids call.<br>339 = size of oids_chomp; 339 size of next_leaf_str.<br> ..1.3.6.1.4.1.22782 (cuttedge) = first oid; .1.3.6.1.4.1.22782.1.1.1 (productType) = first leaf.<br>perl_module.pl loaded ok<br>registering at cuttedge<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br> netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>netsnmp_assert !"registration != duplicate" failed agent_registry.c:535 netsnmp_subtree_load()<br>started us as a subagent (NetSNMP::agent=HASH(0x1182030))<br> BEFORE registration at cuttedge<br>AFTER registration at cuttedge<br>Yes I am a subagent approaching running loop.<br>::::::::::::::<br>sasnip.pl<br>:::::::::: ::::<br>BEGIN {<br> if ($DEBUG) { print STDERR "starting perl_module.pl\n"; }<br> }</div> <div> <p>use NetSNMP::OID (':all');<br>use NetSNMP::agent (':all');<br>use NetSNMP::ASN (':all');</p> <p>if ($DEBUG) { print STDERR "perl_module.pl loaded ok\n"; }</p> <p># set to 1 to get extra debugging information</p> <p>$debugging = 1;</p> <p># if we're not embedded, this will get auto-set below to 1<br>$subagent = 1;</p> <p># where we are going to hook onto<br>my $regoid = new NetSNMP::OID('.1.3.6.1.4.1.22782');<br>if ($DEBUG) { print STDERR "registering at ", $regoid, "\n" if ($debugging); }</p> <p># If we're not running embedded within the agent, then try to start<br># our own subagent instead.<br>if ( !$agent ) {<br> $agent = new NetSNMP::agent(<br> 'Name' => 'test', # reads test.conf<br> 'AgentX' => 1<br> ); &n bsp; # make us a subagent<br> $subagent = 1;<br> if ($DEBUG) { print STDERR "started us as a subagent ($agent)\n"; }<br>}</p> <p># we register ourselves with the master agent we're embedded in. The<br># global $agent variable is how we do this:<br>print STDERR "BEFORE registration at $regoid\n" if ($DEBUG);<br>$agent->register( 'myname', $regoid, \&my_snmp_handler );<br> print STDERR "AFTER registration at $regoid\n" if ($DEBUG);</p> <p>if ($subagent) {<br> my $firstrun = 1;<br> print STDERR "Yes I am a subagent approaching running loop.\n" if ($DEBUG);<br> # We need to perform a loop here waiting for snmp requests. We<br> # aren't doing anything else here, but we could.<br> $SIG{'INT'} = \&shut_it_down;<br> $SIG{'QUIT'} = \&shut_it_down;<br> $running = 1;<br> while ($running) {<br> $agent->agent_check_and_process(1); &nbs p; # 1 = block<br> if ($firstrun) {<br> print STDERR "Got past agent_check_and_process once.\n" if ($DEBUG);<br> $firstrun = 0;<br> }<br> print STDERR ":" if ($DEBUG);<br> }<br> $agent->shutdown();<br>}<br></p></div> <div><span class="gmail_quote">On 4/16/08, <b class="gmail_sendername">Larry Dickson</b> <<a href="mailto:ldickson@cuttedge.com">ldickson@cutte dge.com</a>> wrote:</span> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"> <div>Good call, Dave: I put the line in snmpd.conf and restarted. Everything came up happily (and I noticed that /var/agentx/master exists as a socket, where even the directory /var/agentx had not existed before). For some reason it is behaving as if the subagent is not there, i.e. skipping over our subtree when I do a "getnext". But I expect I can turn on DEBUG in the subagent and track it down. If not, I'll get back to you...</div> <div> </div> <div>Thanks,</div> <div> </div><span class="sg"> <div>Larry<br> </div></span> <div><span class="e" id="q_11957ad12b1039e5_2"> <div><span class="gmail_quote">On 4/16/08, <b class="gmail_sendername">Dave Shield</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:D.T.Shield@liverpool.ac.uk" target="_blank">D.T.Shield@liverpool.ac.uk</a>> wrote:</span> <blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On 15/04/2008, Larry Dickson <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:ldickson@cuttedge.com" target="_blank">ldickson@cuttedge.com</a>> wrote:<br> > netsnmp_assert !"registration != duplicate" failed<br>> agent_registry.c:535 netsnmp_subtree_load()<br>> netsnmp_assert !"registration != duplicate" failed<br>> agent_registry.c:535 netsnmp_subtree_load()<br> > netsnmp_assert !"registration != duplicate" failed<br>> agent_registry.c:535 netsnmp_subtree_load()<br><br>You can ignore those - they're harmless.<br><br><br>> Turning on AgentX master support.<br> > Error: Couldn't open a master agentx socket to listen on ():<br><br>Who are you running this agent as? Root, or a different user?<br><br>Do you have an "agentXSocket" directive in your snmpd.conf file?<br> What AgentX-related config settings do you have?<br><br>Does the directory /var/agentx exist before you start the agent?<br>What about the socket /var/agentx/master<br>(both before and after starting the agent).<br><br><br> > &nbs p; Th is means agentx_sockets =<br>> strdup(netsnmp_get_string(NETSNMP_DS_APPLICATION_I D,<br>> NETSNMP_DS_AGENT_X_SOCKET)) returned nothing<br><br>That's normal.<br>This is the mechanism for overriding the default AgentX socket<br> (either via the 'AgentXSocket' config directive, or the -x command<br>line option).<br><br><br>The issue actually lies with setting the default value (a few lines later).<br>This changed from<br> agentx_sockets = strdup( {NETSNMP_}AGENTX_SOCKET );<br> <br>in the 5.2.x and 5.3.x lines, and is now<br> agentx_sockets = strdup( "" );<br><br>This was part of SVN revision 15258, aimed at introducing a<br>more flexible transport creation mechanism. It may be that<br> this has broken (or changed) the default AgentX behaviour.<br><br>A simple workaround would be to specify the AgentX port<br>explicitly - either in the snmpd.conf file<br><br> agentXSocket /var/agentx/master<br><br>or on the command line<br> <br> snmpd -x /var/agentx/master .....<br><br>Dave<br></blockquote></div><br></span></div></blockquote></div><br> ------=_Part_7285_23847028.1208367335329-- --===============0008042677== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757...un.com/javaone --===============0008042677== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/...et-snmp-coders --===============0008042677==-- |