SNMP_command [OPTIONS] AGENT [PARAMETERS]
This reference page describes the common options for the SNMP commands: snmpbulkget, snmpbulkwalk, snmpdelta, snmpget, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptable, snmptest, snmptrap, snmpusm, and snmpwalk. The command line applications use the SNMP protocol to communicate with an SNMP capable network entity, an agent. Individual applications typically (but not necessarily) take additional parameters that are given after the agent specification. These parameters are documented in the reference pages for each application.
Sets the authentication protocol (MD5|SHA) used for authenticated SNMPv3 messages.
Sets the authentication pass phrase used for authenticated SNMPv3 messages.
Sets the community string for SNMPv1/v2c transactions.
Dumps (in hexadecimal) the sent and received SNMP packets.
Turns on debugging output for the given TOKEN(s). Try ALL for extremely verbose output.
Sets the authoritative (security) engineID used for SNMPv3 REQUEST messages. This is the engineID of the agent or proxy (for example, 800000020109840301). (will be discovered if not supplied)
Set the context engineID used for SNMPv3 REQUEST messages scopedPdu. This is the engineID of the agent (for example, 800000020109840301). (will be authoritative engineID if not specified)
Displays a brief usage message and then exit.
Displays a list of configuration file directives understood by the command and then exit.
Specifies input parsing options. See INPUT OPTIONS below.
Set the securityLevel used for SNMPv3 messages (noAuthNoPriv|authNoPriv|authPriv). Appropriate pass phrase(s) must provided when using any level higher than noAuthNoPriv.
Specifies a colon separated list of MIB modules to load for this application. This overrides the environment variable MIBS.
The special keyword ALL is used to specify all modules in all directories when searching for MIB files. Every file whose name does not begin with . will be parsed as if it were a MIB file.
Specifies a colon separated list of directories to search for MIBs. This overrides the environment variable MIBDIRS.
Sets the destination contextName used for SNMPv3 messages. The default contextName is the empty string "".
Specifies output printing options. See OUTPUT OPTIONS below.
Specifies MIB parsing options. See MIB PARSING OPTIONS below.
Specifies the number of retries to be used in the requests. The default is 5.
Specifies the timeout in seconds between retries. The default is 1.
Sets the securityName used for authenticated SNMPv3 messages.
-v1 | 2c | 3
Specifies the protocol version to use: 1 (RFCs 1155-1157), 2c (RFCs 1901-1908), or 3 (RFCs 2571-2574). The default is version 1.
Displays version information for the application and then exit.
Sets the privacy protocol (DES) used for encrypted SNMPv3 messages.
Sets the privacy pass phrase used for encrypted SNMPv3 messages.
Sets the engineBoots and engineTime used for authenticated SNMPv3 messages. This will initialize the local notion of the agents boots/time with an authenticated value stored in the LCD. (will be discovered if not supplied)
The string AGENT specifies the remote SNMP entity with which to communicate. The format of this parameter is defined in the AGENT SPECIFICATION section below.
The AGENT specification takes the form:
At its simplest, the AGENT specification may consist of a hostname, or an IPv4 address in the standard "dotted quad" notation. In this case, communication will be attempted using UDP/IPv4 to port 161 of the given host. Otherwise, the transport-address part of the specification is parsed according to the following table:
transport-specifier transport-address format udp hostname[:port] or IPv4-address[:port] tcp hostname[:port] or IPv4-address[:port] unix pathname ipx [network]:node[/port] aal5pvc or pvc [interface.][VPI.]VCI udp6 or udpv6 or udpipv6 hostname[:port] or IPv6-address[:port] tcp6 or tcpv6 or tcpipv6 hostname[:port] or IPv6-address[:port]
Note that transport-specifier strings are case-insensitive so that, for example, "tcp" and "TCP" are equivalent. Here are some examples, along with their interpretation:
performs query using UDP/IPv4 datagrams to hostname on port 161. The ":161" is redundant here since that is the default SNMP port in any case.
is identical to the previous specification. The "udp:" is redundant here since UDP/IPv4 is the default transport.
connects to hostname on port 1161 using TCP/IPv4 and perform query over that connection.
performs query using IPX datagrams to node number 00D0B7AAE308 on the default network, and using the default IPX port of 36879 (900F hexadecimal), as suggested in RFC 1906.
performs query using IPX datagrams to port 1161 on node number 00D0B721C6C0 on network number 0AE43409.
connects to the UNIX domain socket /tmp/local-agent, and performs the query over that connection.
is identical to the previous specification, since the UNIX domain is the default transport iff the first character of the transport-address is a /.
performs the query using AAL5 PDUs sent on the permanent virtual circuit with VPI=0 and VCI=100 (decimal) on the first ATM adapter in the machine.
performs the query using AAL5 PDUs sent on the permanent virtual circuit with VPI=10 (decimal) and VCI=32 (decimal) on the second ATM adapter in the machine. Note that PVC is a synonym for AAL5PVC.
performs the query using UDP/IPv6 datagrams to port 10161 on hostname (which will be looked up as an AAAA record).
performs the query using UDP/IPv6 datagrams to port 161 at address fe80::2d0:b7ff:fe21:c6c0.
connects to port 161 on the local host (::1 in IPv6 parlance) using TCP/IPv6 and perform query over that connection.
Note that not all the transport domains listed above will always be available; for instance, hosts with no IPv6 support will not be able to use udp6 transport addresses, and attempts to do so will result in the error "Unknown host". Likewise, since AAL5 PVC support is only currently available on Linux, it will fail with the same error on other platforms.
The Net-SNMP MIB parser mostly adheres to the Structure of Management Information (SMI). As that specification has changed through time, and in recognition of the (ahem) diversity in compliance expressed in MIB files, additional options provide more flexibility in reading MIB files.
Shows some warning messages in resolving the MIB files. Can be also set with the configuration token "mibWarningLevel".
Shows additional warning messages. Can be also set with the configuration token "mibWarningLevel".
Does not show MIB errors. Can be also set with the configuration token "showMibErrors".
Allows ASN.1 comment to extend to the end of the MIB source line. This overcomes some problems with manually maintained MIB files. Can be also set with the configuration token "strictCommentTerm".
Collects the DESCRIPTION information into the parsed hierarchy. This increases the memory used by the size of each DESCRIPTION clause.
Allows underline characters in symbols. Can be also set with the configuration token "mibAllowUnderline".
Replaces MIB objects using the last read MIB file.
Setting this option may result in an incorrect hierarchy. Can be also set with the configuration token "mibReplaceWithLatest".
Output display can be controlled by passing various parameters to the
The default output looks as follows:
snmpget -c public localhost system.sysUpTime.0 system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
Removes the equal sign and type information:
Gives you the complete OID:
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
Deletes all but the last symbolic part of the OID:
sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
Is a variation on
-Osthat adds the name of the MIB that defined the object:
SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63 (from release 5.0, this is now the default output format)
Prints the OID in the UCD-style (inherited from the original CMU code) removing a series of "standard" prefixes (if relevant).
system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
Prints the OID numerically:
.220.127.116.11.18.104.22.168.0 = Timeticks: (14096763) 1 day, 15:09:27.63
Removes the symbolic labels from enumerations:
snmpget -c public localhost ip.ipForwarding.0 ip.ipForwarding.0 = forwarding(1) snmpget -c public -Oe localhost ip.ipForwarding.0 ip.ipForwarding.0 = 1
When OIDs contain a index to a table, they are broken into the displayable pieces and shown to you. For example the OID vacmSecurityModel.0.3.119.101.115 is nicely broken down by default and the string hidden in the OID is shown to you as vacmSecurityModel.0."wes". The
-Oboption disables this feature and displays it as vacmSecurityModel.0.3.119.101.115 again. -OE
This modifies the index strings to include a \\ to escape the quotes, to allow them to be reused in shell commands, such as vacmSecurityModel.0.\\"wes\\".
This modifies the output of index OIDs, to look more "program like". If you take an entry from the IPV6-MIB::ipv6RouteTable, it is indexed with an IPv6 address and two integers, and if you are used to IPv6 addresses you will know that decimal OIDs are not the preferred notation. Compare:
snmpgetnext -OS host IPV6-MIB:ipv6RouteTable IPV6-MIB::ipv6RouteIfIndex.22.214.171.124.255.0.0.0.0.0.0.0.0.0.0.0.64.1 = 2 snmpgetnext -OSX host IPV6-MIB:ipv6RouteTable IPV6-MIB::ipv6RouteIfIndex[3ffe:100:ff00:0:0:0:0:0] = 2
If hexadecimal code is printed, this will also print any printable characters after the hexadecimal codes.
Outputs only the variable value, not the OID:
snmpget -c public -Ov localhost ip.ipForwarding.0 forwarding(1)
Outputs timeticks values as raw numbers:
system.sysUpTime.0 = 14096763
Note that most of these options can be turned on or off by default by tuning the snmp.conf file. See the snmp.conf reference page for details.
-IRflag specifies random access lookup, so that if the entire OID path is not specified, it will search for a node in the MIB tree with the given name. Normally, you'd have to specify the vacmSecurityModel OID above as:
but the use of the
-IRflag allows you to shorten that to just vacmSecurityModel.0."wes".
Additionally, see the RANDOM ACCESS MIBS section below.
-Ibflag indicates that the expression you gave it is actually a regular expression that should be used to search for the best match possible in the MIB tree. This would allow you to specify the node vacmSecurityModel MIB node as something as generic as vacmsecuritymodel (since case insensitive searches are done) or vacm.*model. Note that multiple matches are obviously possible (.* matches everything), and the best result is currently calculated as the one that matches the closest to the beginning of the node name and the highest in the tree. A current side effect of this option is that you can't specify indexes or multiple nodes, since the . is treated as part of the regular expression. -Iu
Uses the traditional UCD-style input approach of assuming that OIDs are rooted at the 'mib-2' point in the tree (unless they start with an explicit .) If random access lookup is in effect (which is the default for most commands), then this will only affect OIDs specified with a leading numberic subidentifier (and no initial .) Thus an input of snmpcmd ... 1 would refer to 'iso' (from v5.0 onwards) while snmpcmd -Iu ... 1 would refer to 'system'.
By default, indices into tables and values to be assigned to objects are checked against range and type specified in the MIB. The
-Irflag disables this check. This flag is mostly useful when you are testing an agent. For normal operation it is useful to get your requests checked before they are sent to the remote agent (the diagnostic that the library can provide is also much more precise).
In previous releases of the UCD-SNMP package (and if using the
The standard prefix for object identifiers (if using UCD-style output). Defaults to .iso.org.dod.internet.mgmt.mib-2.
The list of MIBs to load. Defaults to SNMPv2-TC:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:SNMP-VACM-MIB. Overridden by the
The list of directories to search for MIBs. Defaults to $PREFIX/share/snmp/mibs. Overridden by the
Agent configuration file. See snmpd.conf.
Application configuration files. See snmp.conf.
All UNIX systems. Windows 7. Windows Server 2008 R2. Windows 8. Windows Server 2012. Windows 10. Windows Server 2016.
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
- snmpbulkget, snmpbulkwalk, snmpdelta, snmpget, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptable, snmptest, snmptrap, snmpusm, snmpwalk
- File Formats:
PTC MKS Toolkit 10.1 patch 1 Documentation Build 2.