Agent++:How to change values from code


I’m a newby in SNMP. I’m doing some testing on SNMP++ & Agent++ with good results but I’ve a simple but important doubt: how to change the values in the MIB from code?
Implementing an Agent I need to change the value that client can GET using SNMP command from code.
At the moment I’ve tried this with success (only for test purpuses) but It seems a bit complicated:

// Create simple MIB values
mib.add(new sysGroup(“Interfaccia MIB”, “”, 10,”, “Luca Leoncavallo”, “Italy”));

// the email OID is then I try to change it from code
SnmpDisplayString Prova;
Prova = (SnmpDisplayString
// Now I’ve the pointer to the MibEntryPtr of the VB
Vb vb; // construct a Vb object
vb.set_syntax( sNMP_SYNTAX_OCTETS );
vb.set_value( “” );

It works but is it the right way to do it?



Hello Luca,

you can also use the set_value(const SnmpSyntax& v) function:

Kind regards,

In addition to the code you use, you should also make sure that you synchronise your write operation(s) with possible read/write operations of the AGENT++ framework.

See the following FAQ article for details: