SNMP(1) | General Commands Manual | SNMP(1) |
snmp
— simple SNMP
client
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 ...] |
The snmp
utility is a simple SNMP
client.
The subcommands are as follows:
snmp
get
[options] agent oid ...snmp
getnext
[options] agent oid ...snmp
walk
[options] agent
[oid]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 ...-v
1
.snmp
bulkwalk
[options] agent
[oid]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
...snmp
trap
[options] agent uptime trapoid
[varoid type value ...]-v
1
.snmp
df
[options] agentsnmp
mibtree
[-O
fnS] [oid
...]The options are as follows:
-A
authpass-v
3
.-a
digestMD5
, SHA
,
SHA-224
, SHA-256
,
SHA-384
or SHA-512
. This
option defaults to MD5
. This option is only used
by -v
3
.-C
appoptbulkget
, 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
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
endoidwalk
, walk the tree up to but excluding
endoid. The blank before
endoid is mandatory.h
df
print the output in
“human-readable” format.I
walk
, do not fall back to returning the
original MIB via a get
request.i
walk
and bulkwalk
,
always do a get
request on the specified
oid first.n
nonrepbulkget
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
walk
or bulkwalk
,
also show a summary of the total variables received.r
maxrepbulkget
, 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
skipoidwalk
or bulkwalk
don't include skipoid or its children in the
walk output. The blank before skipoid is
mandatory.t
walk
, Show how long it took to walk the
entire tree.-c
communitypublic
. This option is only used by
-v
1
and
-v
2c
.-e
secengineid-v
3
.-E
ctxengineid-v
3
.-K
localpriv0x
). This option is
only used by -v
3
.-k
localauth0x
). This option is
only used by -v
3
.-l
seclevelnoAuthNoPriv
(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-v
3
.-O
outputa
f
n
Q
q
S
v
x
The mibtree
subcommand may only use
the [-fnS
] output options; no output options are
available for trap
.
-r
retries-t
timeout-u
user-v
3
is used this option is required. This option is only used by
-v
3
.-v
version1
, 2c
or
3
. Currently defaults to
2c
.-X
privpass-v
3
.-x
cipherDES
and AES
. This option
is only used by -v
3
.-Z
boots,time-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.
Additional data sent to the server is formatted by specifying one or more triples of varoid, type, and value. Supported types are:
a
b
c
d
i
n
o
s
t
u
x
LC_CTYPE
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 (‘.’).
The snmp
program first appeared in
OpenBSD 6.6.
The snmp
program was written by
Martijn van Duren
<martijn@openbsd.org>.
September 14, 2020 | OpenBSD-current |