On Fri, 2013-03-08 at 12:45 -0800, Pal Saint wrote:
> unregister_mib fails even for standard UCD-DLMOD MIB.
> While registering all the columns are explicitly registered. But
> during unregistering, unregister_mib tries to do an exact match with
> the root oid to the subtree children that were registered. This seems
> to fail.
> Checking if unregister_mib_range might help.
> Could someone comment if you have experience in this area? Thanks
>
>
> On Fri, Mar 8, 2013 at 12:09 PM, Pal Saint <[email protected]> wrote:
> I added additional debugging to 'agent_registry.c' file and
> recompiled. During unregistering the MIB, the agent complaints
> about not finding the child and
> returns MIB_NO_SUCH_REGISTRATION.
>
>
> My subagents registers MIB using default context ("") and
> default priority. Any idea why the registering succeeds but
> not unregistering MIB? I appreciate your insights and
> pointers.
What is the code you use for unregistration?
Normally unregistration is done as a mirror of registration, so to
mirror the registration you got done you need to mirror REGISTER_MIB,
like this:
/* generated code */
void
init_foo(void)
{
DEBUGMSGTL(("foo", "Initializing\n"));
/* register ourselves with the agent to handle our mib tree */
REGISTER_MIB("foo", foo_variables, variable4,foo_variables_oid);
/* place any other initialization junk you need here */
}
/* New code you need to add */
void
shutdown_foo(void)
{
DEBUGMSGTL(("foo", "Shutting down\n"));
/* unregister ourselves with the agent */
unregister_mib(foo_variables_oid, OID_LENGTH(foo_variables_oid));
}
You also failed to say which version of Net-SNMP you are working with.
Also, if reporting things like this then a working minimal example of
the problem is appreciated - right now I have tried to guess what your
problem is and I might have guessed wrong.
/MF
>
> 1695 while(unregistering){
> 1696 DEBUGMSGTL(("register_mib", "unregistering "));
> 1697 DEBUGMSGOIDRANGE(("register_mib", name, len,
> range_subid, range_ubound));
> 1698 DEBUGMSG(("register_mib", "\n"));
> 1699
> 1700 list = netsnmp_subtree_find(name, len,
> netsnmp_subtree_find_first(context),
> 1701 context);
> 1702 if (list == NULL) {
> 1703 DEBUGMSGTL(("register_mib", "pal:failed to
> find subtree"));
> 1704 return MIB_NO_SUCH_REGISTRATION;
> 1705 }
> 1706
> 1707 for (child = list, prev = NULL; child != NULL;
> 1708 prev = child, child = child->children) {
> 1709 if (netsnmp_oid_equals(child->name_a,
> child->namelen, name, len) == 0 &&
> 1710 child->priority == priority) {
> 1711 break; /* found it */
> 1712 }
> 1713 }
> 1714
> 1715 if (child == NULL) {
> 1716 DEBUGMSGTL(("register_mib", "pal:failed null
> child")); <<<<<<<<<<<< Returns from here
> 1717 return MIB_NO_SUCH_REGISTRATION;
> 1718 }
>
>
>
>
> On Thu, Mar 7, 2013 at 1:22 AM, Pal Saint <[email protected]>
> wrote:
> All,
>
>
> We use REGISTER_MIB() to register our MIB tables, and
> use unregister_mib() for unregistering them. However,
> when SIGHUP is sent to snmpd, it fails to unregister
> the MIB variables. It fails with
> "MIB_NO_SUCH_REGISTRATION". Registering and
> unregistering code is actually created by
> mib2c.old_api code generation configuration. Let me
> know if you need more information.
>
>
> Here is snmpd debug info...
>
>
> dlmod: dlmod_create_module
> dlmod: dlmod_load_module
> exampleTable: /usr/lib/snmp/dlmod/exampleTable.so
> ................. Registering exampleTable
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.1 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.2 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.3 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.4 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.5 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.6 with context ""
> register_mib: registering "exampleTable" at
> SNMPv2-SMI::enterprises.8075.1.3.2.1.7 with context ""
>
>
> ...
> dlmod: Calling deinit_exampleTable()
> deinit_exampleTable: unregistering exampleTable...
> register_mib: unregistering
> SNMPv2-SMI::enterprises.8075.1.3.2
> deinit_exampleTable: unregistering exampleTable
> failed:-1
> dlmod: Module exampleTable unloaded
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________ Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders