Set commands

Set commands set the value of data items in the SNMP agent.

There are two set commands for each version of SNMP. The snmpset form of the command uses the default port number to communicate with the probe, and the snmpset_p form of the command uses the port number specified in the command.

SNMP V1 and V2c

The set command for SNMP V1 and V2c that uses the default port on the SNMP agent has the following format:

$OMNIHOME/bin/nco_http -uri probeuri:probeport/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "setcommand", "hostname":"destinationhost", "oid":"oid", "type":"type", "value": "value", "community":"community"}]}' -method post

Where setcommand takes one of the following values, depending on your version of SNMP:

  • SNMPSET
  • SNMPSET_V2C

The command that specifies the port to use on the SNMP agent has the following format:

$OMNIHOME/bin/nco_http -uri probeuri:probeport/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "setcommand", "hostname":"destinationhost", "oid":"oid", "type":"type", "value": "value", "community":"community", "port":"port"}]}' -method post

Where setcommand takes one of the following values, depending on your version of SNMP:

  • SNMPSET_P
  • SNMPSET_V2C_P

SNMP V3

The set command for SNMP V3 that uses the default port on the SNMP agent has the following format:

$OMNIHOME/bin/nco_http -uri probeuri:probeport/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "SNMPSET_V3", "hostname":"destinationhost", "userid":"userid", "oid":"oid", "type":"type", "value": "value"}]} -method post

The command that specifies the port to use on the SNMP agent has the following format:

$OMNIHOME/bin/nco_http -uri probeuri:probeport/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "SNMPSET_V3_P", "hostname":"destinationhost", "userid": "userid", "oid":"oid", "type":"type", "value": "value", "port":"port"}]}' -method post

Examples

The following example sets the value of the sysLocation object in the SNMP agent to First floor computer room. The command uses port 4990 on the agent and SNMP V2c:

$OMNIHOME/bin/nco_http -uri http://test28.example.com:6789/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "SNMPSET_V2C_P", "hostname":"9.127.128.299", "oid":".1.3.6.1.2.1.1.6.0", "type":"s", "value": "First floor computer room", "community":"private", "port":"4990"}]}' -method post

The following example also sets the value of the sysLocation object using SNMP V3. The command uses the default port on the agent and a user name of snmpadmin:

$OMNIHOME/bin/nco_http -uri http://test28.example.com:6789/probe/common -datatype application/json -data '{"eventfactory": [{"snmpreq": "SNMPSET_V3", "hostname":"9.127.128.299", "userid":"snmpadmin", "oid":".1.3.6.1.2.1.1.6.0", "type":"s", "value": "First floor computer room"}]}' -method post