SNMP(1) FreeBSD General Commands Manual SNMP(1)
NAME
snmp - simple SNMP client
SYNOPSIS
snmp get | getnext | bulkget [options] agent oid ...
snmp walk | bulkwalk [options] agent [oid]
snmp set [options] agent varoid type value [varoid type value] ...
snmp trap [options] agent uptime trapoid [varoid type value] ...
snmp df [options] agent
snmp mibtree [-O fns] [oid ...]
DESCRIPTION
The snmp utility is a simple SNMP client.
The subcommands are as follows:
snmp get [options] agent oid ...
Retrieve the varbind for oid from the agent. If more than one
oid is specified, retrieve the varbind for each one.
snmp getnext [options] agent oid ...
Retrieve the varbind that follows oid from the agent. If more
than one oid is specified, retrieve the varbind following each
one of them.
snmp walk [options] agent [oid]
Retrieve all the varbinds that are branches of oid from the
agent. This uses the getnext subcommand internally and requests
a single varbind at a time. If no oid is specified, it defaults
to mib-2 (.1.3.6.1.2.1).
snmp bulkget [options] agent oid ...
Retrieve the next 10 varbinds following each oid from the agent.
This command is not available for -v 1.
snmp bulkwalk [options] agent [oid]
Retrieve all the varbinds from the agent that are branches of
oid. This uses the bulkget subcommand internally to retrieve
multiple varbinds at a time. This command is not available for
-v 1.
snmp set [options] agent varoid type value ...
Set one or more varoid to a new value. The format of the varoid
type value triple is described in Data types, below.
snmp trap [options] agent uptime trapoid [varoid type value ...]
Send a trap message to the agent. The uptime is specified in
timeticks (centiseconds) or defaults to the system uptime if an
empty string is given. The trapoid is the identification OID
used by the trap handler to determine its action. This command
is not available for -v 1.
snmp df [options] agent
An SNMP based version of the df(1) command. If no size suffix is
shown, the sizes are in kilobytes.
snmp mibtree [-O fnS] [oid ...]
Dump the tree of compiled-in MIB objects. If oid is specified it
will print the objects in the requested output format if
available, or print a warning if the object can't be found.
The options are as follows:
-A authpass
The authentication password for the user. This will be
transformed to localauth. This option is only used by -v 3.
-a digest
Set the digest (authentication) protocol. Options are MD5, SHA,
SHA-224, SHA-256, SHA-384 or SHA-512. This option defaults to
SHA. This option is only used by -v 3.
-C appopt
For the bulkget, bulkwalk, df, and walk subcommands, set the
application specific appopt options by supplying a string of one
or more of the following modifier letters:
c For walk and bulkwalk, disable checking the order of
MIBs. On some devices that return MIBs out of order,
this may cause an infinite loop.
E endoid
For walk, walk the tree up to but excluding endoid. The
blank before endoid is mandatory.
h For df print the output in "human-readable" format.
I For walk, do not fall back to returning the original MIB
via a get request.
i For walk and bulkwalk, always do a get request on the
specified oid first.
nnonrep
For bulkget and bulkwalk, Set the non-repeaters field in
the request to the non-negative integer nonrep. This
causes the first nonrep oid arguments to only return a
single MIB instead of maxrep. This value defaults to 0.
No blank is allowed before nonrep.
p For walk or bulkwalk, also show a summary of the total
variables received.
rmaxrep
For bulkget, bulkwalk and df, set the max-repetitions
field in the request to the positive integer maxrep.
This determines the amount of MIBs to return for each
specified OID. This value defaults to 10. No blank is
allowed before maxrep.
s skipoid
For walk or bulkwalk don't include skipoid or its
children in the walk output. The blank before skipoid is
mandatory.
t For walk, Show how long it took to walk the entire tree.
-c community
Set the community string. This option is only used by -v 1 and
-v 2c and has no default.
-e secengineid
The USM security engine id. Under normal circumstances this
value is discovered via snmpv3 discovery and does not need to be
specified. This option is only used by -v 3.
-E ctxengineid
The snmpv3 context engine id. Most of the time this value can be
safely ignored. This option is only used by -v 3.
-K localpriv
The localized privacy password for the user in hexadecimal format
(optionally prefixed with a 0x). This option is only used by -v
3.
-k localauth
The localized authentication password for the user in hexadecimal
format (optionally prefixed with a 0x). This option is only used
by -v 3.
-l seclevel
The security level. Values can be noAuthNoPriv (default),
authNoPriv (requires either -A or -k) or authPriv (requires
either -X or -K in addition to the authNoPriv requirements).
This option is only used by -v 3.
-n ctxname
Sets the context name. Defaults to an empty string. This option
is only used by -v 3.
-O output
Set the output options by supplying a string of one or more of
the following modifier letters:
a Print the varbind string unchanged rather than replacing non-
printable bytes with dots.
f When displaying an OID, include the full list of MIB objects.
By default only the last textual MIB object is shown.
n Display the OID numerically.
Q Remove the type information.
q Remove the type information and the equal sign.
S Display the MIB name and the type information. This is the
default behaviour.
v Only display the varbind value, removing the OID.
x Display the varbind string values as hexadecimal strings.
The mibtree subcommand may only use the [-fnS] output options; no
output options are available for trap.
-r retries
Set the number of retries in case of packet loss. Defaults to 5.
-t timeout
Set the timeout to wait for a reply, in seconds. Defaults to 1.
-u user
Sets the username. If -v 3 is used, this option is required.
This option is only used by -v 3.
-v version
Set the snmp protocol version to either 1, 2c or 3. Currently
defaults to 3.
-X privpass
The privacy password for the user. This will be transformed to
localpriv. This option is only used by -v 3.
-x cipher
Sets the cipher (privacy) protocol. Options are DES and AES.
This option defaults to AES. This option is only used by -v 3.
-Z boots,time
Set the engine boots and engine time. Under normal circumstances
this value is discovered via snmpv3 discovery and does not need
to be specified. This option is only used by -v 3.
The syntax for the agent argument is [protocol:]address, with the
following format:
protocol address
udp | tcp hostname[:port] | IPv4-address[:port]
udp6 | tcp6 hostname[:port] | [IPv6-address][:port] |
IPv6-address:port
unix pathname
The default protocol is udp and the default port is 161, except for the
trap subcommand, which uses 162. udpv6 and udpipv6 are aliases for udp6;
tcpv6 and tcpipv6 for tcp6. To specify an IPv6-address without a port,
the IPv6-address must be enclosed in square brackets. If the square
brackets are omitted, the value after the last colon is always
interpreted as a port.
Data types
Additional data sent to the server is formatted by specifying one or more
triples of varoid, type, and value. Supported types are:
a An IPv4 Address.
b A bitstring. A list of individual bit offsets separated by
comma, space or tab. Must be supplied as a single argument.
c A counter32.
d A decimal string. A list of individual bytes in decimal form
separated by space or tab.
i An integer.
n A null object.
o An OID.
s A regular string.
t Timeticks in centiseconds.
u Unsigned integer.
x A hex string. Similar to a decimal string, but in hexadecimal
format.
ENVIRONMENT
LC_CTYPE The character encoding locale(1) used for output. It decides
whether objects having a display format of UTF-8 are printed as
UTF-8, and whether each byte invalid according to the object's
display format is printed as a UTF-8 replacement character
(`<?>').
If unset or set to "C", "POSIX", or an unsupported value, for
objects having a display format of UTF-8, each printable non-
ASCII character is replaced with a single dot (`.'). Each byte
invalid according to the object's display format is printed as
a question mark (`?').
Each non-printable character is always replaced with a single
dot (`.').
SEE ALSO
snmpd(8)
HISTORY
The snmp program first appeared in OpenBSD 6.6.
AUTHORS
The snmp program was written by Martijn van Duren <
[email protected]>.
FreeBSD 14.1-RELEASE-p8 March 31, 2022 FreeBSD 14.1-RELEASE-p8