OpenBSD manual page server

Manual Page Search Parameters

SNMP(1) General Commands Manual SNMP(1)

snmpsimple 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 ...
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:

authpass
The authentication password for the user. This will be transformed to localauth. This option is only used by -v 3.
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.
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:
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.
endoid
For walk, walk the tree up to but excluding endoid. The blank before endoid is mandatory.
For df print the output in “human-readable” format.
For walk, do not fall back to returning the original MIB via a get request.
For walk and bulkwalk, always do a get request on the specified oid first.
nonrep
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.
For walk or bulkwalk, also show a summary of the total variables received.
maxrep
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.
skipoid
For walk or bulkwalk don't include skipoid or its children in the walk output. The blank before skipoid is mandatory.
For walk, Show how long it took to walk the entire tree.
community
Set the community string. This option is only used by -v 1 and -v 2c and has no default.
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.
ctxengineid
The snmpv3 context engine id. Most of the time this value can be safely ignored. This option is only used by -v 3.
localpriv
The localized privacy password for the user in hexadecimal format (optionally prefixed with a 0x). This option is only used by -v 3.
localauth
The localized authentication password for the user in hexadecimal format (optionally prefixed with a 0x). This option is only used by -v 3.
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.
ctxname
Sets the context name. Defaults to an empty string. This option is only used by -v 3.
output
Set the output options by supplying a string of one or more of the following modifier letters:
Print the varbind string unchanged rather than replacing non-printable bytes with dots.
When displaying an OID, include the full list of MIB objects. By default only the last textual MIB object is shown.
Display the OID numerically.
Remove the type information.
Remove the type information and the equal sign.
Display the MIB name and the type information. This is the default behaviour.
Only display the varbind value, removing the OID.
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.

retries
Set the number of retries in case of packet loss. Defaults to 5.
timeout
Set the timeout to wait for a reply, in seconds. Defaults to 1.
user
Sets the username. If -v 3 is used, this option is required. This option is only used by -v 3.
version
Set the snmp protocol version to either 1, 2c or 3. Currently defaults to 3.
privpass
The privacy password for the user. This will be transformed to localpriv. This option is only used by -v 3.
cipher
Sets the cipher (privacy) protocol. Options are DES and AES. This option defaults to AES. This option is only used by -v 3.
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
| hostname[:port] | IPv4-address[:port]
| hostname[:port] | IPv6-address][:port] | IPv6-address:port
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:

An IPv4 Address.
A bitstring. A list of individual bit offsets separated by comma, space or tab. Must be supplied as a single argument.
A counter32.
A decimal string. A list of individual bytes in decimal form separated by space or tab.
An integer.
A null object.
An OID.
A regular string.
Timeticks in centiseconds.
Unsigned integer.
A hex string. Similar to a decimal string, but in hexadecimal format.

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 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 (‘.’).

snmpd(8)

The snmp program first appeared in OpenBSD 6.6.

The snmp program was written by Martijn van Duren <martijn@openbsd.org>.

March 31, 2022 OpenBSD-7.6