SYNOPSIS
SNMP_command [OPTIONS] AGENT [PARAMETERS]
DESCRIPTION
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.
OPTIONS
-a authProtocol-
Sets the authentication protocol (MD5|SHA) used for authenticated SNMPv3 messages.
-A authPassword-
Sets the authentication pass phrase used for authenticated SNMPv3 messages.
-c community-
Sets the community string for SNMPv1/v2c transactions.
-d -
Dumps (in hexadecimal) the sent and received SNMP packets.
-D TOKEN[,...]-
Turns on debugging output for the given TOKEN(s). Try ALL for extremely verbose output.
-e engineID-
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)
-E engineID-
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)
-h -
Displays a brief usage message and then exit.
-H -
Displays a list of configuration file directives understood by the command and then exit.
-I brR-
Specifies input parsing options. See INPUT OPTIONS below.
-l secLevel-
Set the securityLevel used for SNMPv3 messages (noAuthNoPriv|authNoPriv|authPriv). Appropriate pass phrase(s) must provided when using any level higher than noAuthNoPriv.
-m MIBLIST-
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.
-M DIRLIST-
Specifies a colon separated list of directories to search for MIBs. This overrides the environment variable MIBDIRS.
-n contextName-
Sets the destination contextName used for SNMPv3 messages. The default contextName is the empty string "".
-O nEebqfsSvXT-
Specifies output printing options. See OUTPUT OPTIONS below.
-P cdeRuwW-
Specifies MIB parsing options. See MIB PARSING OPTIONS below.
-r retries-
Specifies the number of retries to be used in the requests. The default is 5.
-t timeout-
Specifies the timeout in seconds between retries. The default is 1.
-u secName-
Sets the securityName used for authenticated SNMPv3 messages.
-v 1 | 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.
-V -
Displays version information for the application and then exit.
-x privProtocol-
Sets the privacy protocol (DES) used for encrypted SNMPv3 messages.
-X privPassword-
Sets the privacy pass phrase used for encrypted SNMPv3 messages.
-Z boots,time-
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.
AGENT SPECIFICATION
The AGENT specification takes the form:
[transport-specifier:]transport-address
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:
- hostname:161
-
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.
- udp:hostname
-
is identical to the previous specification. The "udp:" is redundant here since UDP/IPv4 is the default transport.
- TCP:hostname:1161
-
connects to hostname on port 1161 using TCP/IPv4 and perform query over that connection.
- ipx::00D0B7AAE308
-
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.
- ipx:0AE43409:00D0B721C6C0/1161
-
performs query using IPX datagrams to port 1161 on node number 00D0B721C6C0 on network number 0AE43409.
- unix:/tmp/local-agent
-
connects to the UNIX domain socket /tmp/local-agent, and performs the query over that connection.
- /tmp/local-agent
-
is identical to the previous specification, since the UNIX domain is the default transport iff the first character of the transport-address is a /.
- AAL5PVC:100
-
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.
- PVC:1.10.32
-
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.
- udp6:hostname:10161
-
performs the query using UDP/IPv6 datagrams to port 10161 on hostname (which will be looked up as an AAAA record).
- UDP6:fe80::2d0:b7ff:fe21:c6c0
-
performs the query using UDP/IPv6 datagrams to port 161 at address fe80::2d0:b7ff:fe21:c6c0.
- "tcpipv6:::1"
-
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.
MIB PARSING OPTIONS
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.
-Pw -
Shows some warning messages in resolving the MIB files. Can be also set with the configuration token "mibWarningLevel".
-PW -
Shows additional warning messages. Can be also set with the configuration token "mibWarningLevel".
-Pe -
Does not show MIB errors. Can be also set with the configuration token "showMibErrors".
-Pc -
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".
-Pd -
Collects the DESCRIPTION information into the parsed hierarchy. This increases the memory used by the size of each DESCRIPTION clause.
-Pu -
Allows underline characters in symbols. Can be also set with the configuration token "mibAllowUnderline".
-PR -
Replaces MIB objects using the last read MIB file.
- Warning
-
Setting this option may result in an incorrect hierarchy. Can be also set with the configuration token "mibReplaceWithLatest".
OUTPUT OPTIONS
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
-Oq -
Removes the equal sign and type information:
system.sysUpTime.0 1:15:09:27.63
-Of -
Gives you the complete OID:
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-Os -
Deletes all but the last symbolic part of the OID:
sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-OS -
Is a variation on
-Os that 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)
-Ou -
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
-On -
Prints the OID numerically:
.1.3.6.1.2.1.1.3.0 = Timeticks: (14096763) 1 day, 15:09:27.63
-Oe -
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
-Ob -
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
-Ob option 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\\".
-OX -
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.63.254.1.0.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][64][1] = 2
-OT -
If hexadecimal code is printed, this will also print any printable characters after the hexadecimal codes.
-Ov -
Outputs only the variable value, not the OID:
snmpget -c public -Ov localhost ip.ipForwarding.0 forwarding(1)
-Ot -
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.
INPUT OPTIONS
The
-IR -
The
-IR flag 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:.iso.org.dod.internet.snmpV2.snmpModules.snmpVacmMIB.vacmMIBObjects.vacmSecurityToGroupTable.vacmSecurityToGroupEntry.vacmSecurityModel.0."wes"
but the use of the
-IR flag allows you to shorten that to just vacmSecurityModel.0."wes".Additionally, see the RANDOM ACCESS MIBS section below.
-Ib -
The
-Ib flag 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'.
-Ir -
By default, indices into tables and values to be assigned to objects are checked against range and type specified in the MIB. The
-Ir flag 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).
RANDOM ACCESS MIBS
In previous releases of the UCD-SNMP package (and if using the
ENVIRONMENT VARIABLES
- PREFIX
-
The standard prefix for object identifiers (if using UCD-style output). Defaults to .iso.org.dod.internet.mgmt.mib-2.
- MIBS
-
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
-m option.
MIBDIRS
-
The list of directories to search for MIBs. Defaults to $PREFIX/share/snmp/mibs. Overridden by the
-M option.
FILES
- $PREFIX/share/snmp/snmpd.conf
-
Agent configuration file. See snmpd.conf.
- $PREFIX/share/snmp/snmp.conf
- ~/.snmp/snmp.conf
-
Application configuration files. See snmp.conf.
PORTABILITY
All UNIX systems. Windows 2000. Windows XP. Windows Server 2003. Windows Vista.
AVAILABILITY
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Commands:
- snmpbulkget, snmpbulkwalk, snmpdelta, snmpget, snmpgetnext, snmpnetstat, snmpset, snmpstatus, snmptable, snmptest, snmptrap, snmpusm, snmpwalk
- File Formats:
- snmp.conf
MKS Toolkit 9.2 Documentation Build 16.