Wrong Group OID in generated files for a module

Hello,

I use MIB Designer to create my MIB file. There is an Module defined and the comment for
OID is correct (generate by Designer): – 1.3.6.1.4.1.PEN.1.1.3.
When the code is generated for that module the default constructor for the module initialize MibGroup with OID which is: --1.3.6.1.4.1.PEN, but it should be 1.3.6.1.4.1.PEN.1.1.3.

When I fix this issue in the code I am able get the values using MIB Explorer.

Can you please, help?

Regards,
Safet

Hello Safet,

What object did you define in your MIB module for the following OID?

The OID of the MibGroup is not used in the agent for any data returned, it is just to identify that object (object identifier). That OID is not used to in SNMP responses. You could use 1.10.20 too.

So I wonder, what you fix in the code? I do not think that there needs to be fixed anything.

The MibGroup OID is derived from the OIDs included in the group by the code generation. It is simply some common parent OID.

Best regards,
Frank

Hello Frank,

I my MIB file I have one module and it has to have OID, right? It is here:

PEN-sts-MIB MODULE-IDENTITY
LAST-UPDATED “202011241541Z” – Nov 24, 2020, 3:41:00 PM
ORGANIZATION “PEN International Corp.”
CONTACT-INFO
"Email: support@pen.com "
DESCRIPTION
"PEN International Corp. Management Information MIB.

            Copyright November  2020 PEN International Corp."
    
    REVISION "202011241541Z"        -- Nov 24, 2020, 3:41:00 PM
    DESCRIPTION
            "Initial version."

– 1.3.6.1.4.1.PEN.1.1.3 – ::= { PENModules 3 }

Then the AgenPro generate class for the modules and init its leafs:

pen_sts_mib::pen_sts_mib():
MibGroup(“1.3.6.1.4.1.50562”, “pen_sts_mib”)
{
//–AgentGen BEGIN=pen_sts_mib::pen_sts_mib
//–AgentGen END
add(new pen_sts_mib_stsCfgDeviceCode());
add(new pen_sts_mib_stsIdentSerialNumber());
add(new pen_sts_mib_stsIdentSocomecRef());
add(new pen_sts_mib_stsIdentUserDevRef());
add(new pen_sts_mib_stsIdentUserDevLoc());
add(new pen_sts_mib_stsStatysStatus());
//–AgentGen BEGIN=pen_sts_mib::pen_sts_mib:post
//–AgentGen END
}

As you can see the MibGroup is generated with 1.3.6.1.4.1.PEN.
In the code in the class constructor I replaced 1.3.6.1.4.1.PEN with 1.3.6.1.4.1.PEN.1.1.3.
If there is no this fix when I try to GET an OID from this module it says “noSuchObject”

Regards,
Safet

I still do not think, that the “fix” and the query result have a direct connection. Have you seen the following warning in your log before applying the change to the generated code?

MibContext: duplicate MibGroup registration (context)(oid)

That would have made sense then, because then there were two groups of objects with the same OID and the agent then refuses to add the second group to its MIB object tree. In that case, using any other OID for the second group of objects makes sense - to avoid the clash.

The OID of the MIB module definition is not used by AgenPro for the group OID, because there are probably other objects with an OID below 1.3.6.1.4.1.50562 but not below 1.3.6.1.4.1.50562.1.1.3 defined in the MIB module. That is legal but not the best MIB module writing style, because it makes it more complicated to manage OID usage in an organisation.

Hello Frank,

I review the generated code and the reason why there is duplicated MibGroup is that the OID for the MibGroup for two different modules are the same: 1.3.4.1.50562. Both modules are registered under the subtree of the module registration OID:
–enterprises
|____ pen(PEN)
|___penReg(1)
| |____penGlobalRegModule(1)
| |____penProducstModule(2)
| |____penSTS(3)
|
|___penGeneric(2)

So when the code is generated from AgenPro the OID for the MibGroup for
penGlobalRegModule, penProducstModule, and penSTS have 1.3.6.1.4.1.PEN.
What I would expect to see here is: 1.3.6.1.4.1.PEN.1.1.1, 1.3.6.1.4.1.PEN.1.1.2 and 1.3.6.1.4.1.PEN.1.1.3 respectively.

What do I overseen here? Please, help.

Regards,
Safet

Hello Frank,

You are right for the duplicated MibGroup log if there is no “fix”.
I follow the AgentPP OID organization looking at AGENTPP-GLOBAL-REG and AGENTPP-TEST-MIB… So I created : PEN-GLOBAL-REG.mib, PEN-PRODUCTS-MIB.mib, and each product will have to include those two. When the code is generated from AGENTPP-TEST-MIB the OID for MibGroup match for this the OID in that module. That’s why I though it is using that OID.
I will review one more time the organization of our OID, but I did it multiple times, and I am sure I follow the way how it is done in AGENTPP, before I open the topic.

You think I should change the way how the OID are organized?

Regards,
Safet

Hi Safet,

You can change the cpp_code.vm template at line 890 from

MibGroup("$agenUtils.getRootOid($module)", "$moduleNameNoHyphen.toLowerCase()")

to

MibGroup("$module.getPrintableOid()", "$moduleNameNoHyphen.toLowerCase()")

With that change you get a guaranteed unique OID.
Note: This works with SMIv2 MIB modules only - that is why it is not yet the default!

Hello Frank,

It worked.

Thank you.

Regards,
Safet