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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote:
> >
> > On 15/04/2008, Larry Dickson <[EMAIL PROTECTED]> 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_ID,
> > > 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
> >
>
>
-------------------------------------------------------------------------
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;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to