NAME
snmp
—
simple SNMP client
SYNOPSIS
snmp |
get | getnext
[-A authpass]
[-a digest]
[-c community]
[-E ctxengineid]
[-e secengineid]
[-K localpriv]
[-k localauth]
[-l seclevel]
[-n ctxname]
[-O afnQqSvx ]
[-r retries]
[-t timeout]
[-u user]
[-v version]
[-X privpass]
[-x cipher]
[-Z
boots,time]
agent oid ... |
snmp |
walk [-A
authpass] [-a
digest] [-c
community] [-E
ctxengineid] [-e
secengineid] [-K
localpriv] [-k
localauth] [-l
seclevel] [-n
ctxname] [-O
afnQqSvx ] [-r
retries] [-t
timeout] [-u
user] [-v
version] [-X
privpass] [-x
cipher] [-Z
boots,time]
[-C cIipt ]
[-C E
endoid] agent
[oid] |
snmp |
bulkget [-A
authpass] [-a
digest] [-c
community] [-E
ctxengineid] [-e
secengineid] [-K
localpriv] [-k
localauth] [-l
seclevel] [-n
ctxname] [-O
afnQqSvx ] [-r
retries] [-t
timeout] [-u
user] [-v
version] [-X
privpass] [-x
cipher] [-Z
boots,time]
[-C
n nonrepr maxrep]
agent oid ... |
snmp |
bulkwalk [-A
authpass] [-a
digest] [-c
community] [-E
ctxengineid] [-e
secengineid] [-K
localpriv] [-k
localauth] [-l
seclevel] [-n
ctxname] [-O
afnQqSvx ] [-r
retries] [-t
timeout] [-u
user] [-v
version] [-X
privpass] [-x
cipher] [-Z
boots,time]
[-C
cipn nonrepr maxrep]
agent [oid] |
snmp |
set [-A
authpass] [-a
digest] [-c
community] [-E
ctxengineid] [-e
secengineid] [-K
localpriv] [-k
localauth] [-l
seclevel] [-n
ctxname] [-O
afnQqSvx ] [-r
retries] [-t
timeout] [-u
user] [-v
version] [-X
privpass] [-x
cipher] [-Z
boots,time]
agent varoid type value
[varoid type value] ... |
snmp |
trap [-A
authpass] [-a
digest] [-c
community] [-E
ctxengineid] [-e
secengineid] [-K
localpriv] [-k
localauth] [-l
seclevel] [-n
ctxname] [-r
retries] [-t
timeout] [-u
user] [-v
version] [-X
privpass] [-x
cipher] [-Z
boots,time]
agent uptime trapoid [varoid type
value] ... |
snmp |
mibtree [-O
fnS ] |
DESCRIPTION
The snmp
utility is a simple SNMP
client.
The subcommands are as follows:
get
- Retrieve the MIB for oid from the agent. If more than one oid is specified, retrieve the MIB for each one.
getnext
- Retrieve the MIB that follows oid from the agent. If more than one oid is specified, retrieve the MIB following each one of them.
walk
- Retrieve all the MIBs that are branches of oid from
the agent. This uses the
getnext
subcommand internally and requests a single MIB at a time. If no OID is specified it defaults to mib-2 (.1.3.6.1.2.1). bulkget
- Retrieve the next 10 MIBs following each oid from
the agent. This command is not available for
-v
1
. bulkwalk
- Retrieve all the MIBs from the agent that are
branches of oid. This uses the
bulkget
subcommand internally to retrieve multiple MIBs at a time. This command is not available for-v
1
. set
- Set one or more OIDs to a new value. The triple varoid, type, value is described in Data types.
trap
- 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. The triple [varoid,
type, value] is described in
Data types. This command is not
available for
-v
1
. mibtree
- Dump the tree of compiled-in MIB objects.
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
orSHA-512
. This option defaults toMD5
. This option is only used by-v
3
. -C
appopt- Set the application specific appopt options by
supplying a string of one or more of the following modifier letters:
c
- During a
walk
orbulkwalk
, disable checking the order of MIBs. On some devices that return MIBs out of order, this may cause an infinite loop. E
endoid- Walk the tree up to but excluding endoid. The blank before endoid is mandatory.
I
- If no branches are found during a
walk
, do not fall back to returning the original MIB via aget
request. i
- Before starting a
walk
orbulkwalk
, always do aget
request on the specified oid first. n
nonrep- 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
- At the end of a
walk
orbulkwalk
, show a summary of the total variables received. r
maxrep- Set the max-repetitions field in the request to the positive integer
maxrep. For
bulkget
orbulkwalk
this determines the amount of MIBs to return for each specified OID. This value defaults to 10. No blank is allowed before maxrep. t
- Show how long it took to
walk
the entire tree.
-c
community- Set the community string. Defaults to
public
. This option is only used by-v
1
and-v
2c
. -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
) orauthPriv
(requires either-X
or-K
in addition to theauthNoPriv
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.
-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
or3
. Currently defaults to2c
. -X
privpass- The privacy password for the user. This will be tansformed to
localpriv. This option is only used by
-v
3
. -x
cipher- Sets the cipher (privacy) protocol. Options are
DES
andAES
. 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 follwing forms:
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 snmp
trap
command 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. Actually a normal integer for compatibility with netsnmp.
x
- A hex string. Similar to a decimal string, but in hexadecimal format.
SEE ALSO
HISTORY
The snmp
program first appeared in
OpenBSD 6.6.
AUTHORS
The snmp
program was written by
Martijn van Duren
<martijn@openbsd.org>.