|BSNMPGET(1)||FreeBSD General Commands Manual||BSNMPGET(1)|
NAMEbsnmpget, bsnmpwalk, bsnmpset — simple tools for querying SNMP agents
|bsnmpget||[ -aDdehnK][ -A options][ -b buffersize][ -C options][ -I options][ -i filelist][ -l filename][ -M max-repetitions][ -N non-repeaters][ -o output][ -P options][ -p pdu][ -r retries][ -s [trans::][community@][server][:port]][ -t timeout][ -U options][ -v version][ OID ...]|
|bsnmpwalk||[ -dhnK][ -A options][ -b buffersize][ -C options][ -I options][ -i filelist][ -l filename][ -o output][ -P options][ -r retries][ -s [trans::][community@][server][:port]][ -t timeout][ -U options][ -v version][ OID ...]|
|bsnmpset||[ -adehnK][ -A options][ -b buffersize][ -C options][ -I options][ -i filelist][ -l filename][ -o output][ -P options][ -r retries][ -s [trans::][community@][server][:port]][ -t timeout][ -U options][ -v version] OID= syntax: value [ OID= syntax: value ...]|
DESCRIPTIONbsnmpget, bsnmpwalk and bsnmpset are simple tools for retrieving management information from and setting management information to a Simple Network Management Protocol (SNMP) agent.
Depending on the options bsnmpget constructs either a SNMP GetRequest, GetNextRequest or a GetBulkRequest packet, fills in the object identifiers (OIDs) of the objects whose values will be retrieved, waits for a response and prints it if received successfully.
Bsnmpwalk queries an agent with ether SNMP GetNextRequest or GetBulkRequest packets, asking for values of OID instances that are a part of the object subtree rooted at the provided OIDs.
Bsnmpset constructs a SNMP SetRequest packet, fills in the OIDs (object identifiers), syntaxes and values of the objects whose values are to be set and waits for a response from server.
OPTIONSThe options are as follows (not all apply to all three programs):
- -A options
Authentication options to use with SNMPv3 PDUs
- The protocol to use when calculating the PDU message digest.
- A binary localized authentication key to use when calculating the PDU message digest.
By default SNMPv3 PDUs are sent unauthenticated.
- Skip any sanity checks when adding OIDs to a Protocol Data Unit (PDU): ingore syntax/access type, allow adding of non-leaf objects for GetPdu and read-only objects to a SetPDU.
- -b buffersize
- Tune the size of buffers used to send and receive packets. The default size is 10000 bytes which should be enough unless an agent sends a really large octetstring. The maximum allowed length is 65535 according to the Structure of Management Information (SMIv2).
- -C options
The context to query with SNMPv3 PDUs.
- The context name. Default is "" (empty).
- The SNMP Engine ID of the context to query with SNMPv3 PDUs, represented as binary octet string. By default, this is set to the Engine ID of the SNMP agent.
- Perform SNMP USM Engine Discovery, rather than sending a request for the value of a specific object.
- Turn on debugging. This option will cause the packets sent and received to be dumped to the terminal.
- Retry on error. If an error is returned in the response PDU, resend the request removing the variable that caused the error until a valid response is received. This is only useful for a GetRequest- and a GetNextRequest-PDU.
- Print a short help text with default values for various options.
- -I options
Load each MIB description file from the given list to translate symbolic object names to their numerical representation and vice versa. Use the other options to obtain a non-default behaviour:
- Specifies the initial OID that was cut by gensnmpdef(1) when producing the MIB description file. The default value is .iso(1).org(3).dod(6) which is what should have been used for all the files installed under /usr/share/snmp/defs. Use this only if you generated your own files, providing a -c option to gensnmpdef(1).
- The directory where files in the list will be searched. The default is /usr/share/snmp/defs.
- A comma separated list of files to which the two options above will apply.
The file suboption has to come after the other suboptions so that their non-default values will be applied to the list of files. The order of the other suboptions before each file suboption can be random. Suboptions may be separated either by commas or by spaces. If using spaces make sure the entire option string is one argument, for example using quotes.
- -i filelist
- List of MIB description files produced by gensnmpdef(1) which bsnmpget, bsnmpwalk or bsnmpset will search to translate numerical OIDs to their symbolic object names. Multiple files can be provided either giving this option multiple times or a comma separated list of file names. If a filename begins with a letter the default directory, /usr/share/snmp/defs, will be searched.
- Calculate and display the localized authentication and privacy keys corresponding to a plain text password. The password is obtained via the environment. Additionally, if one or more OIDs are specified, the calculated keys are used when processing the SNMPv3 requests.
- -l filename
- The path of the posix local (unix domain) socket if local transport is used.
- -M max-repetitions
- The value for the max-repetitions field in a GetBulk PDU. Default is 10.
- -N non-repeaters
- The value for the non-repeaters field in a GetBulk PDU. Default is 0.
- Only use numerical representations for input and output OIDs and do not try to resolve symbolic object names. Note that bsnmpget, bsnmpwalk and bsnmpset will print numerical OIDs anyway if the corresponding string representation is not found in the MIB description files.
- -o [quiet|short|verbose]
- The format used to print the received response. Quiet only prints values, short (default) prints an abbreviated OID representation and the value. In addition to the short output verbose prints the type before the value.
- -P options
Privacy options to use with SNMPv3 PDUs
- The protocol to use when encrypting/decrypting SNMPv3 PDU data.
- A binary localized privacy key to use when encrypting/decrypting SNMPv3 PDU data.
By default plain text SNMPv3 PDUs are sent.
- -p [get|getnext|getbulk]
- The PDU type to send by bsmpget and bsnmpwalk. Default is get for bsmpget and getnext for bsnmpwalk. Getbulk allows executing the so called SNMP "bulkwalks" allowing the values of multiple columns to be retrieved in a single PDU by bsnmpwalk.
- -r retries
- Number of resends of request packets before giving up if the agent does not respond after the first try. Default is 3.
- -s [trans::] [community@] [server] [:port]
Each of the server specification components is optional but at least one has to be provided if the
s option is used. The server specification is constructed in the following manner:
- Transport type may be one of udp, stream or dgram. If this option is not provided an UDP inet/inet6 socket will be used, which is the most common. Stream stands for a posix local stream socket and a posix local datagram socket will be used if dgram is specified.
- Specify an SNMP community string to be used when sending packets. If the option is skipped the default "public" will be used for bsnmpget and bsnmpwalk and the default "private" community string will be used for bsnmpset.
- This might be either the IP address or the hostname where the agent is listening. The default is “localhost”.
- The destination port to send the requests to. This is useful if the SNMP agent listens on a non-default port. Default is given by the “snmp” entry in /etc/services, port 161.
- -t timeout
- Number of seconds before resending a request packet if the agent does not respond. The default value is 3 seconds.
- -U options
User credentials when sending SNMPv3 PDUs.
- The Engine ID of the SNMP agent represented as a binary octet string.
- The value of the snmpEngineBoots of the SNMP agent.
The value of the snmpEngineTime of the SNMP agent.
If any of the above is not specified, SNMP USM Engine Discovery is attempted. This is also the default behavior.
- The USM user name to include in the SNMPv3 PDUs. By default, the user name is obtained via the environment.
- -v version
- The SNMP protocol version to use when sending requests. SNMP versions 1, 2 and 3 are supported. If no version option is provided bsnmpget, bsnmpwalk and bsnmpset will use version 2. Note that GetBulkRequest-PDUs were introduced in SNMPv2 thus setting the version to 1 is incompatible with sending a GetBulk PDU.
The object identifier whose value to retrieve. At least one OID should be provided for
bsnmpget to be able to send a request.
For bsnmpwalk this is the root object identifier of the subtree whose values are to be retrieved. If no OID is provided bsnmpwalk will walk the mib2 subtree rooted at .iso(1).org(3).dod(6).internet(1).mgmt(2).mib2(1) .
Any of the formats used to print a single variable is valid as input OID:
- (requires the -o verbose option)
Square brackets are used to denote an entry's indexes. When used in an input OID, the square brackets may have to be escaped or the OID has to be quoted to protect it from the shell. Note there is no difference between ifName.1 and "ifName".
- OID= [syntax:] value
The object identifier with its syntax type and value that is to be set. At least one such string OID=[syntax:]value should be provided to
bsnmpset to be able to send a request.
OID may be input as a string, a string followed by a random number of integers (suboids) separated by dots, a sequence of integers separated by dots - that is if the
n option is used - and in such case a syntax is required for every value, or a string followed by square brackets (used to denote an entry's indexes) and corresponding indexes. Any of the formats used to print a single variable by
bsnmpset is valid as input OID as well:
- sysLocation=OctetString:"@ Home" (with -o verbose option)
- sysLocation.0="@ Home"
- (with the -o verbose option)
- where the syntax string is one of: Integer, OctetString, OID, IpAddress, Counter32, Gauge, TimeTicks, Counter64.
- The value to be set - IP address in form of u.u.u.u - for example 220.127.116.11.1.2.0=IpAddress:192.168.0.1, strings require inverted-commas if they contain any special characters or spaces, all other numeric types do not.
ENVIRONMENTbsnmpget, bsnmpwalk and bsnmpset use the following environment variables:
- Specifies a default SNMP USM authentication protocol.
- Specifies a default SNMP USM privacy protocol.
- Specifies a default SNMP USM user name.
- Specifies the SNMP USM plain text password to use when calculating localized authentication and privacy keys. If this variable exists in the environment, SNMPv3 is the default version to use for outgoing requests.
|January 10, 2012||FreeBSD|