BSNMPGET(1)
π bsnmpget(1) π β General Commands Manual, section 1
okay so before we even start: this is the manual for bsnmpget, bsnmpwalk and bsnmpset, and they live in section 1 of the General Commands Manual. three little tools, one big page, and honestly? they're lowkey iconic once you get what they do. let's go π«Ά
β¨ 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 πΈ
okay so picture this: bsnmpget, bsnmpwalk and bsnmpset are your three little besties for talking to a Simple Network Management Protocol (SNMP) agent. two of them retrieve management information from it, and one of them sets management information on it. slay π
depending on the options you give it, bsnmpget builds either a SNMP GetRequest, a GetNextRequest or a GetBulkRequest packet, fills in the object identifiers (OIDs) of the objects whose values you wanna retrieve, waits for a response, and prints it if it came back successfully. no cap, that's the whole vibe.
Bsnmpwalk is the wanderer of the group β it 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 OIDs you provided. it's giving "walk the whole tree, bestie" π³
Bsnmpset is the one that actually changes things: it constructs a SNMP SetRequest packet, fills in the OIDs (object identifiers), syntaxes and values of the objects whose values are to be set, and then waits for a response from the server. main character energy, but be careful with this one π
π OPTIONS π
here's the rundown, bestie β and note that not all of these apply to all three programs (iykyk):
-Aoptions β 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. that's the default, not a judgement π
-aβ skip any sanity checks when adding OIDs to a Protocol Data Unit (PDU): ignore syntax/access type, allow adding of non-leaf objects forGetPduand read-only objects to aSetPDU. it's giving "I know what I'm doing" β hopefully you do π-bbuffersize β tune the size of buffers used to send and receive packets. the default size is10000bytes, which should be enough unless an agent sends a really large octetstring. the maximum allowed length is65535according to the Structure of Management Information (SMIv2). big buffer energy β¨-Coptions β 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. it's giving detective mode π-dβ turn on debugging. this option will cause the packets sent and received to be dumped to the terminal. honestly the most fun you can have with a terminal, ngl π-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 aGetRequest- and aGetNextRequest-PDU. stubborn little icon π-hβ print a short help text with default values for various options. when in doubt,-hit out π«Ά-Ioptions β 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 bygensnmpdef(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-coption togensnmpdef(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.
β οΈ thefilesuboption 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 eachfilesuboption 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. no cap, this trips people up π
-ifilelist β list of MIB description files produced bygensnmpdef(1)whichbsnmpget,bsnmpwalkorbsnmpsetwill 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. key girl summer ππ-lfilename β the path of the posix local (unix domain) socket if local transport is used.-Mmax-repetitions β the value for themax-repetitionsfield in aGetBulkPDU. default is10.-Nnon-repeaters β the value for thenon-repeatersfield in aGetBulkPDU. default is0.-nβ only use numerical representations for input and output OIDs and do not try to resolve symbolic object names. note thatbsnmpget,bsnmpwalkandbsnmpsetwill print numerical OIDs anyway if the corresponding string representation is not found in the MIB description files. numbers only, no names, no vibes π’-o [quiet|short|verbose]β the format used to print the received response.quietonly prints values;short(default) prints an abbreviated OID representation and the value. in addition to the short output,verboseprints the type before the value. choose your aesthetic π«-Poptions β 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. yes, plain text. that's just what the default is π
-p [get|getnext|getbulk]β the PDU type to send bybsmpgetandbsnmpwalk. default isgetforbsmpgetandgetnextforbsnmpwalk.Getbulkallows executing the so called SNMP "bulkwalks", allowing the values of multiple columns to be retrieved in a single PDU bybsnmpwalk. bulk it up, bestie π₯-rretries β number of resends of request packets before giving up if the agent does not respond after the first try. default is3. never give up, never surrender (for three tries) π€-s [trans::][community@][server][:port]β each of the server specification components is optional but at least one has to be provided if thesoption is used. the server specification is constructed in the following manner:trans::β transport type may be one ofudp,streamordgram. if this option is not provided, an UDP inet/inet6 socket will be used, which is the most common.Streamstands for a posix local stream socket and a posix local datagram socket will be used ifdgramis specified.community@β specify an SNMP community string to be used when sending packets. if the option is skipped, the default"public"will be used forbsnmpgetandbsnmpwalkand the default"private"community string will be used forbsnmpset.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, port161.
-ttimeout β number of seconds before resending a request packet if the agent does not respond. the default value is3seconds. β°-Uoptions β 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 thesnmpEngineBootsof the SNMP agent.engine-time=valueβ the value of thesnmpEngineTimeof 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. π«Ά
-vversion β the SNMP protocol version to use when sending requests. SNMP versions1,2and3are supported. if no version option is provided,bsnmpget,bsnmpwalkandbsnmpsetwill use version2. note thatGetBulkRequest-PDUs were introduced in SNMPv2, thus setting the version to1is incompatible with sending aGetBulkPDU. π don't do that to yourself.- OID β the object identifier whose value to retrieve. at least one OID should be provided for
bsnmpgetto be able to send a request. one is the minimum, bestie π
- OID β and here's the tea for
bsnmpwalkspecifically π« this is the root object identifier of the subtree whose values are gonna get retrieved. And if you don't hand over an OID at all? No stress, bestie,bsnmpwalkwill just walk the wholemib2subtree rooted at.iso(1).org(3).dod(6).internet(1).mgmt(2).mib2(1). Default slay β¨
Any of the formats used to print a single variable is valid as input OID too β literally any of them π
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)
So those square brackets [ ]? They're how you denote an entry's indexes π But heads up β when you use them in an input OID, the square brackets may have to be escaped, or the whole OID has to be quoted, to protect it from the shell. Your shell is not your friend here, she's the main character of her own story π And yeah, there is no difference between ifName.1 and "ifName[1]" β same thing, different outfit π
OID=[syntax:]valueβ the object identifier, plus its syntax type, plus the value that's about to be set π At least one suchOID=[syntax:]valuestring should be provided tobsnmpsetto be able to send a request. Zero of them = no request, no vibes, nothing sent π- OID β and this one is flexible fr fr.
OIDmay 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
noption 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.
- OID β and this one is flexible fr fr.
And 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. That's the whole squad, no additions, no substitutions π§ - value β the value to be set π IP addresses go in the form
u.u.u.u, for example1.3.1.6.1.2.0=IpAddress:192.168.0.1. Strings require inverted-commas if they contain any special characters or spaces. All the other numeric types? They do not. Numeric girlies don't need the quotes π₯
πΈ ENVIRONMENT πΈ
bsnmpget, bsnmpwalk and bsnmpset use the following environment variables β yes, all three of them, this is a shared situation π«Ά
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. And the iconic plot twist: if this variable exists in the environment,SNMPv3is the default version to use for outgoing requests. Not me setting one env var and changing my whole default version ππ
π¦ SEE ALSO π¦
gensnmpdef(1)
Go read that one too, bestie, it's giving required reading πβ¨
π AUTHORS π
Shteryana Shopova <syrinx@FreeBSD.org>
An absolute legend, no cap π
So yeah, that's the whole vibe β this page comes from the Debian crowd, dated January 10, 2012, and honestly it still ate π Go forth and poll your hearts out, you've got this fr fr ππ¦β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2010 The FreeBSD Foundation
- Copyright (c) 2005-2007 The FreeBSD Project
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms