Get commands
Get commands obtain information from the probe.
There are two get commands for each version of SNMP. The snmpget form of the command uses the default port number to communicate with the probe, and the snmpget_p form of the command uses the port number specified in the command.
SNMP V1 and V2c
The get 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": "getcommand",
"hostname":"destinationhost", "oid":"oid",
"community":"community"}]}' -method post
Where getcommand takes one of the following values, depending on your version of SNMP:
- SNMPGET
- SNMPGET_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": "getcommand",
"hostname":"destinationhost", "oid":"oid",
"community":"community", "port":"port"}]}'
-method post
Where getcommand takes one of the following values, depending on your version of SNMP:
- SNMPGET_P
- SNMPGET_V2C_P
SNMP V3
The get 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": "SNMPGET_V3",
"hostname":"destinationhost", "userid": "userid",
"oid":"oid"}]}' -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": "SNMPGET_V3_P",
"hostname":"destinationhost", "userid": "userid",
"oid":"oid", "port":port}]}'
-method post
Examples
The following example retrieves the value of the sysDescr object in the SNMP agent. The command uses the default port and SNMP V1:
$OMNIHOME/bin/nco_http
-uri http://test28.example.com:6789/probe/common -datatype application/json
-data '{"eventfactory": [{"snmpreq": "SNMPGET", "hostname":"9.127.128.299",
"oid":".1.3.6.1.2.1.1.0", "community":"private"}]}' -method post
The following example also retrieves the value of the sysDescr object, but uses SNMP V3. The command specifies the user as snmpadmin and uses port 4990 on the agent:
$OMNIHOME/bin/nco_http
-uri http://test28.example.com:6789/probe/common -datatype application/json
-data '{"eventfactory": [{"snmpreq": "SNMPGET_V3_P", "hostname":"9.127.128.299",
"userid": "snmpadmin", "oid":".1.3.6.1.2.1.1.0", "port":"4990"}]}'
-method post