SNMP Command-Line Syntax Examples
In some network environments, you are required to specify the SNMP version, community name, hostname, and default port when issuing SNMP commands. For example, to request the value of the object identifier (OID) sysDescr.0 in an IPv4 environment, you might type the following:
%snmpget -v3 -c public 192.0.2.1:161 sysDescr.0
However, it is possible to configure your network environment such that most command-line arguments are not necessary. For example, for SNMP v3, if you set default values for the default SNMP version, community name, and default port, the following syntax is considered valid:
%snmpget SNMP_agent sysDescr.0
Throughout this guide,
SNMP_agent
refers to the hostname or IP address of the system you are querying.
Note:
If you query a device using IPv6 addressing, you must use the following syntax:udp6:[IPv6
address] If the following
message appears in response to the query:
getaddrinfo: node name or service
name not known, try adding
-YdefaultPort=<port_number>
to the SNMP command line arguments.
In addition, the examples in this guide omit most command-line arguments. To configure your network so that most command-line arguments are not necessary, see the following procedure: