snmptable
Retrieve data from SNMP table
TLDR
Fetch data
Display help
SYNOPSIS
snmptable [COMMON OPTIONS] [SNMPTABLE OPTIONS] AGENT [TABLE OID]
PARAMETERS
-v
Specifies the SNMP protocol version (1, 2c, or 3).
-c
Sets the community string for SNMP v1/v2c requests.
-u
Specifies the security name (user name) for SNMP v3 authentication.
-l
Sets the security level for SNMP v3 (noAuthNoPriv, authNoPriv, authPriv).
-a
Defines the authentication protocol for SNMP v3 (MD5 or SHA).
-A
Provides the authentication passphrase for SNMP v3.
-x
Defines the privacy protocol for SNMP v3 (DES, AES).
-X
Provides the privacy passphrase for SNMP v3.
-p
Specifies the UDP port of the SNMP agent.
-t
Sets the timeout duration in seconds before retrying the request.
-r
Specifies the number of retries for the request.
-m
Loads specific MIB modules, overriding the default list.
-M
Specifies directories to search for MIB files.
-Cb
Prevents the printing of table borders.
-CH
Suppresses the printing of column headers.
-CI
Suppresses the printing of table indexes (the first column).
-CA
Displays all columns, including those with no data or zero values for all rows.
-Cc
Prints column comments, which are descriptions from the MIB.
-Cf
Displays full, untruncated values in columns.
-CS
Sorts the table output by index (often the default behavior).
-CW
Sets the maximum column width, truncating longer values.
-CU
Prints the table unsorted, in the order received from the agent.
-On
Displays OIDs numerically.
-Os
Displays OIDs symbolically (default for most outputs).
-Ov
Displays OIDs only as values, suppressing other information.
DESCRIPTION
snmptable is a command-line utility from the Net-SNMP project designed to query an SNMP agent for tabular MIB information and present it in a user-friendly, formatted manner. Unlike snmpwalk, which lists all variables in a subtree, snmptable specifically understands the structure of SNMP tables—conceptual rows of related variables identified by common OID prefixes and indices.
It is particularly useful for fetching structured data such as network interface statistics (e.g., ifTable), routing entries, or connection tables. The command automatically determines column headers from MIB definitions and displays the data in a clear, row-and-column format, similar to a spreadsheet. This intelligent formatting makes it significantly easier to read and interpret complex network device data compared to manually parsing raw SNMP output. snmptable leverages standard SNMP operations like GETNEXT and GETBULK to efficiently retrieve entire table contents, making it an indispensable tool for network monitoring, auditing, and troubleshooting.
CAVEATS
- Requires appropriate MIB files to be loaded and accessible for symbolic OID names and correct column header display.
- Performance can be impacted for extremely large tables due to the iterative nature of SNMP GETNEXT/GETBULK requests.
- May exhibit unexpected behavior if the SNMP agent does not strictly adhere to SMI standards for table structure or returns incomplete data for a table.
- Column formatting can be tricky; use -CW to manage column widths and avoid truncation, or -Cf for full values.
UNDERSTANDING SNMP TABLES
SNMP tables are conceptual collections of related variables, organized into rows and columns. Each row represents a specific instance of an entity (e.g., a network interface), uniquely identified by an index or a combination of indices. Columns correspond to individual SNMP objects (e.g., ifDescr, ifInOctets). snmptable intelligently queries these objects by their common index, groups them, and presents them as formatted rows, making complex MIB data easily digestible.
MIBS AND OUTPUT CUSTOMIZATION
For snmptable to provide meaningful output (e.g., symbolic column headers instead of numerical OIDs), it relies heavily on MIB (Management Information Base) files. These files define the structure, naming, and relationships of SNMP objects. If necessary MIBs are not loaded or found in specified directories (using -m and -M), the output may default to less readable numerical OIDs. Furthermore, snmptable offers extensive output customization options (like -Cb, -CH, -CI, -CA, -Cf, -CS, -CW, -CU) to tailor the presentation of the table to specific needs.
HISTORY
snmptable is an integral part of the Net-SNMP suite (formerly UCD-SNMP), which has been under active development since the mid-1990s. It was developed to address the specific need for displaying structured MIB data in a readable format, building upon the foundational capabilities of `snmpwalk`. Its evolution has focused on robust MIB compliance, efficient data retrieval, and user-friendly output options, making it a staple for network administrators and developers working with SNMP.
SEE ALSO
snmpget(1), snmpwalk(1), snmpgetnext(1), snmpbulkget(1), snmpset(1), snmpd(8)