SNMPTABLE(1)

πŸ’… SNMPTABLE β€” the snmptable(1) page, bestie edition ✨

okay so this is the manual page for snmptable, part of the Net-SNMP crew πŸŽ€. It pulls an SNMP table off a network device and prints it out all nice and tabular. Grab a snack, we're going in πŸ’–


🌸 NAME 🌸

snmptable β€” go get an SNMP table and lay it out in tabular form, gorgeous πŸ’…


✨ SYNOPSIS ✨

snmptable [COMMON OPTIONS] [-Cb] [-CB] [-Ch] [-CH] [-Ci] [-Cf STRING]
[-Cw WIDTH] AGENT TABLE-OID

like. that's the whole vibe. AGENT then TABLE-OID, no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So snmptable is an SNMP application that repeatedly fires off SNMP GETNEXT or GETBULK requests to go query for information on a network entity. She's persistent, she's thorough, she's got main character energy πŸ‘‘

The parameter TABLE-OID must specify an SNMP table. Not a scalar, not a random OID, a table. We'll know if you try it, bestie 😭

AGENT identifies a target SNMP agent β€” like, the thing that's instrumented to monitor the objects you're asking about. At its simplest, the AGENT spec is just a hostname or an IPv4 address. In that situation the command will attempt communication with the agent using UDP/IPv4 to port 161 of the given target host. and if you want the full menu of possible formats for AGENT, go read snmpcmd(1) β€” she has the whole list, periodt πŸ“‹


πŸ’– OPTIONS πŸ’–

🌈 COMMON OPTIONS 🌈

Please see snmpcmd(1) for a list of possible values for COMMON OPTIONS as well as their descriptions. she's the source of truth, iykyk πŸ’œ

πŸŽ€ the -C girlies πŸŽ€

  • -Cb β€” Display only a brief heading. Any common prefix of the table field names will be deleted. bye bye redundancy βœ‚οΈ
  • -CB β€” Do not use GETBULK requests to retrieve data, only GETNEXT. old school, but make it fashion 🧚
  • -Cc CHARS β€” Print table in columns of CHARS characters width. measure twice, print once πŸ“
  • -Cf STRING β€” The string STRING is used to separate table columns. With this option, each table entry will be printed in compact form β€” just with the string given to separate the columns (useful if you want to import it into a database). Otherwise it is printed in nicely aligned columns. so: compact + importable vs. pretty + aligned. your call bestie πŸ’…
  • -Ch β€” Display only the column headings. no data, just labels, she's all dressed up with nowhere to go πŸ™ˆ
  • -CH β€” Do not display the column headings. data only, mystery edition πŸ’€
  • -Ci β€” This option prepends the index of the entry to all printed lines. now you know which row you're looking at πŸ”’
  • -Cl β€” Left justify the data in each column. slay, alignment πŸ’–
  • -Cr REPEATERS β€” For GETBULK requests, REPEATERS specifies the max-repeaters value to use. For GETNEXT requests, REPEATERS specifies the number of entries to retrieve at a time. same option name, two different jobs, she contains multitudes ✨
  • -Cw WIDTH β€” Specifies the width of the lines when the table is printed. If the lines will be longer, the table will be printed in sections of at most WIDTH characters. If WIDTH is less than the length of the contents of a single column, then that single column will still be printed. like, she'll wrap but she won't break your column, that's the rule 🫢

⚠️ ok important, bestie: note that snmptable REQUIRES an argument specifying the agent to query and exactly one OID argument, as described in the snmpcmd(1) manual page. This OID must be that of a MIB table object. no extra OIDs, no zero OIDs, exactly one. we do not negotiate on this πŸ”₯

πŸ“ EXAMPLES πŸ“

first up, the classic. query at.atTable on localhost πŸŽ€

$ snmptable -v 2c -c public localhost at.atTable

SNMP table: at.atTable RFC1213-MIB::atTable

atIfIndex   atPhysAddress   atNetAddress
        1  8:0:20:20:0:ab 130.225.243.33

next, the same thing but in compact form with + as the separator β€” database girlies, this one's for you πŸ’…

$ snmptable -v 2c -c public -Cf + localhost at.atTable

SNMP table: at.atTable

atIfIndex+atPhysAddress+atNetAddress 1+8:0:20:20:0:ab+130.225.243.33

and now the full serve: left justified, GETNEXT only, indices shown, -OX, brief heading, 16-char columns, 64-char width. she's doing the MOST and honestly? iconic πŸ‘‘

$ snmptable localhost -Cl -CB -Ci -OX -Cb -Cc 16 -Cw 64 ifTable

SNMP table: ifTable

Index           Descr           Type            Mtu
Speed           PhysAddress     AdminStatus     OperStatus
LastChange      InOctets        InUcastPkts     InNUcastPkts
InDiscards      InErrors        InUnknownProtos OutOctets
OutUcastPkts    OutNUcastPkts   OutDiscards     OutErrors
OutQLen         Specific

index: [1]
1               lo              softwareLoopbac 16436
10000000                        up              up
?               2837283786      3052466         ?
0               0               ?               2837283786
3052466         ?               0               0
0               zeroDotZero

index: [2]
2               eth0            ethernetCsmacd  1500
10000000        0:5:5d:d1:f7:cf up              up
?               2052604234      44252973        ?
0               0               ?               149778187
65897282        ?               0               0
0               zeroDotZero

the ?s are just the vibe of some fields not existing, we don't make the rules 😭


πŸ’€ BUGS πŸ’€

ok so, real talk. The test for TABLE-OID actually specifying a table is rather heuristic. It's giving guesswork, ngl πŸ™ˆ

Note also that the test requires the defining MIB file to be loaded. no MIB, no vibe check, sorry bestie.


🌈 SEE ALSO 🌈


and that's the whole page, you ate it up, I'm so proud πŸ₯Ή

Net-SNMP Β· V5.9.5.2 Β· 25 Jul 2003 β€” yeah she's vintage, she's a classic, she's still slaying πŸ’–βœ¨πŸ’…πŸ¦‹πŸŒΈπŸ‘‘

πŸ“¦ where this page comes from