|
The snmpset_without_mib example allows the management application or the manager to set (write) the value of an attribute of a managed object in the agent. To perform the SET operation in a remote host where the agent resides, we need to specify the OID, the data type, and the value to be set. In the previous example, the datatype is taken from the loaded MIB file. In this example, instead of loading the MIB file, we will specify the data type explicitly. For example:
|
java snmpset_without_mib localhost 1.5.0 STRING testing |
The above command performs a SET operation with the SNMP agent running on localhost to set (write) the value of the variable 1.5. (sysName) to "testing". To check the new value we can do the snmpget and see the new value being retrieved.
Unlike the previous example we are not loading the MIB file here, because we are specifying the type of the OID.
Usage
The usage of the snmpset_without_mib utility is provided here below. The "-d" option enables the debug and prints the packet dumps. The "host", "OID", any one among the type and the "value" arguments are mandatory and the rest are optional.
java snmpset_without_mib [-v version(v1,v2)] [-c community] [-p port] [-t timeout] [-r retries] [-u user] [-a auth_protocol] [-w auth_password] [-pp privProtocol(DES/AES-128/AES-192/AES-256/3DES)] [-s priv_password] [-d debug] [-m MIB_files] host OID {INTEGER | STRING | GAUGE | TIMETICKS | OPAQUE | IPADDRESS | COUNTER | OID } value [OID type value] ...
Example Command
java snmpset_without_mib 10.3.2.120 sysLocation.0 STRING paradise
Refer the source code of the snmpset_without_mib example in <examples/applications/snmpset_without_mib.java> for more information.
|