Hi,
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”, “1.3.6.1.4.1.4976”, 10,
“luca.leoncavallo@mymail.com”, “Luca Leoncavallo”, “Italy”));
// the email OID is 1.3.6.1.2.1.1.4.0 then I try to change it from code
SnmpDisplayString Prova;
Prova = (SnmpDisplayString)mib.get(“1.3.6.1.2.1.1.4.0”);
// Now I’ve the pointer to the MibEntryPtr of the VB
Vb vb; // construct a Vb object
vb.set_oid(“1.3.6.1.2.1.1.4.0”);
vb.set_syntax( sNMP_SYNTAX_OCTETS );
vb.set_value( “luca.leoncavallo@gmail.com” );
Prova->set_value(vb);
It works but is it the right way to do it?
Thanks
Luca