AGENT++ small issue defining Mib Tables


I would like to define a set of variables in the MIB n which the first one is R/W and the others Read Only.

My first try is to define a group for the oid and then add in the group a MibLeaf and a MibStaticTable. The result is:

MibGroup* gCoolingInfo = new MibGroup(“”);
gCoolingInfo->add(new MibLeaf( “”, READWRITE, SNMP_SYNTAX_INT32)); // remoteCommand
MibStaticTable* ssgCoolingInfo = new MibStaticTable(“”);
ssgCoolingInfo->add(MibStaticEntry(“1.0”, SnmpInt32(2))); // mode
ssgCoolingInfo->add(MibStaticEntry(“2.0”, OctetStr::from_hex_string(“AA”))); // status BITS
ssgCoolingInfo->add(MibStaticEntry(“3.0”, OctetStr::from_hex_string(“11”))); // logicalStatusFlr BITS
ssgCoolingInfo->add(MibStaticEntry(“4.0”, OctetStr::from_hex_string(“22”))); // logicalStatusWrn BITS
ssgCoolingInfo->add(MibStaticEntry(“5.0”, OctetStr::from_hex_string(“33”))); // bitResult BITS
ssgCoolingInfo->add(MibStaticEntry(“6.0”, OctetStr::from_hex_string(“44”))); // bitTested BITS

ssgCoolingInfo->add(MibStaticEntry(“20.0”, OctetStr::from_hex_string(“77”))); // commandOutputStatus BITS

It works and i can GET the values and I can SET the first one. My problem is that I can’f find the way to set the BITS value to sNMP_SYNTAX_BITS instead of OctetStr. The MibStaticEntry accept only oid and default value…


Hi Luca,

The BITS type is in fact an OCTET STRING on the wire. So what are you missing exactly?

Best regards,

Hi Frank,

Thanks for your reply. I see that in fact BITS is implemented as OCTET STRING but i’m wondering if doing a walk of my agent is correct that some variables are displayed ad OCTER STRING instead of BITS. If I use some MIB Browser to analyze MIB files I see that in the MIB structures the difference between OCTET and BITS is present.

Maybe is not important and It’s only aesthetics. Sorry for that, I’m learning…


In the MIB specification, BITS is a different pseudo type than its “parent” OCTET STRING. But on the wire, they are indistinguishable.
If your browser, does not display the BITS values as expected, it might

  • not have the correct MIB modules loaded or
  • MIB module and implementation of the object differ or
  • the browser has a bug

Hope this helps.

Hi Frank,

Thanks for your clarification. In fact I’m walking the agent without the MIB Module. I’m learning how the Agent++ works. You message lead me to another question: do exists a way in agent++ to save the MIB File of the implemented MIB?

At first sight it seems that agent++ cannot load/save mib file. Is it right?



That is right. Thus you cannot use MIB specifications at runtime. But that isn’t a big issue, because MIB specifications should not change often and you would anyway need to implement the instrumentation.

Thus, in agents, using MIB information at compile time is in most cases sufficient. You can do so with AgenPro.