BSNMPGET(1)

NAME
bsnmpget, bsnmpwalk, bsnmpset - simple tools for querying SNMP agents

SYNOPSIS
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 ...]

DESCRIPTION
bsnmpget, 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.

OPTIONS
The options are as follows (not all apply to all three programs):

-A options
    Authentication options to use with SNMPv3 PDUs

    proto=[md5|sha]
        The protocol to use when calculating the PDU message digest.

    key=authkey
        A binary localized authentication key to use when calculating the PDU message digest.

    By default SNMPv3 PDUs are sent unauthenticated.

-a  Skip any sanity checks when adding OIDs to a Protocol Data Unit (PDU): ignore 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.

    context=name
        The context name. Default is "" (empty).

    context-engine=engine-id
        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.

-D  Perform SNMP USM Engine Discovery, rather than sending a request for the value of a specific object.

-d  Turn on debugging. This option will cause the packets sent and received to be dumped to the terminal.

-e  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.

-h  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:

    cut=OID
        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).

    path=filedir
        The directory where files in the list will be searched. The default is /usr/share/snmp/defs.

    file=filelist
        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.

-K  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.

-n  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

    proto=[aes|des]
        The protocol to use when encrypting/decrypting SNMPv3 PDU data.

    key=privkey
        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:

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

    community@
        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.

    server
        This might be either the IP address or the hostname where the agent is listening. The default is "localhost".

    port
        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.

    engine=id
        The Engine ID of the SNMP agent represented as a binary octet string.

    engine-boots=value
        The value of the snmpEngineBoots of the SNMP agent.

    engine-time=value
        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.

    name=username
        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.

OID 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:

    1.3.6.1.2.1.25.1.1.0

    sysDescr

    ifPhysAddress.1

    ifRcvAddressStatus.2.6.255.255.255.255.255.255

    ifRcvAddressType[2,ff:ff:ff:ff:ff:ff]

    ifRcvAddressStatus[Integer:1,OctetString:ff:ff:ff:ff:ff:ff]
        (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[1]".

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

        1.3.6.1.2.1.25.1.1.0=TimeTicks:537615486

        sysLocation=OctetString:"@ Home" (with -o verbose option)

        sysLocation.0="@ Home"

        1.3.6.1.2.1.2.2.1.6.1=OctetString:ffffffffffff

        ifPhysAddress.1="00:02:b3:1d:1c:a3"

        ifRcvAddressStatus.1.6.255.255.255.255.255.255=1

        ifRcvAddressStatus[Integer:1,OctetString:ff:ff:ff:ff:ff:ff]=Integer:1
            (with the -o verbose option)

    syntax
        where the syntax string is one of: Integer, OctetString, OID, IpAddress, Counter32, Gauge, TimeTicks, Counter64.

    value
        The value to be set - IP address in form of u.u.u.u - for example 1.3.1.6.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.

ENVIRONMENT
bsnmpget, bsnmpwalk and bsnmpset use the following environment variables:

SNMPAUTH
    Specifies a default SNMP USM authentication protocol.

SNMPPRIV
    Specifies a default SNMP USM privacy protocol.

SNMPUSER
    Specifies a default SNMP USM user name.

SNMPPASSWD
    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.

SEE ALSO
gensnmpdef(1)

AUTHORS
Shteryana Shopova <syrinx@FreeBSD.org>