2 .\" Copyright (c) 2010 The FreeBSD Foundation
3 .\" All rights reserved.
5 .\" Portions of this documentation were written by Shteryana Sotirova Shopova
6 .\" under sponsorship from the FreeBSD Foundation.
8 .\" Copyright (c) 2005-2007 The FreeBSD Project.
9 .\" All rights reserved.
11 .\" Author: Shteryana Shopova <syrinx@FreeBSD.org>
13 .\" Redistribution and use in source and binary forms, with or without
14 .\" modification, are permitted provided that the following conditions
16 .\" 1. Redistributions of source code must retain the above copyright
17 .\" notice, this list of conditions and the following disclaimer.
18 .\" 2. Redistributions in binary form must reproduce the above copyright
19 .\" notice, this list of conditions and the following disclaimer in the
20 .\" documentation and/or other materials provided with the distribution.
22 .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
26 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 .Nd "simple tools for querying SNMP agents"
48 .Op Fl b Ar buffersize
53 .Op Fl M Ar max-repetitions
54 .Op Fl N Ar non-repeaters
59 .Op Fl s Ar [trans::][community@][server][:port]
68 .Op Fl b Ar buffersize
76 .Op Fl s Ar [trans::][community@][server][:port]
85 .Op Fl b Ar buffersize
93 .Op Fl s Ar [trans::][community@][server][:port]
97 .Ar OID Ns = Ar syntax Ns : Ns Ar value
98 .Op Ar OID Ns = Ar syntax Ns : Ns Ar value ...
104 are simple tools for retrieving management information from and setting
105 management information to a Simple Network Management Protocol (SNMP) agent.
107 Depending on the options
109 constructs either a SNMP GetRequest, GetNextRequest
110 or a GetBulkRequest packet, fills in the object identifiers (OIDs) of the
111 objects whose values will be retrieved, waits for a response and prints it if
112 received successfully.
115 queries an agent with ether SNMP GetNextRequest or GetBulkRequest packets,
116 asking for values of OID instances that are a part of the object subtree
117 rooted at the provided OIDs.
120 constructs a SNMP SetRequest packet, fills in the OIDs (object identifiers),
121 syntaxes and values of the objects whose values are to be set and waits for a
122 response from server.
124 The options are as follows (not all apply to all three programs):
125 .Bl -tag -width ".It Fl D Ar options"
127 Authentication options to use with SNMPv3 PDUs
129 .It Cm proto=[md5|sha]
130 The protocol to use when calculating the PDU message digest.
132 A binary localized authentication key to use when calculating the PDU message
136 By default SNMPv3 PDUs are sent unauthenticated.
138 Skip any sanity checks when adding OIDs to a Protocol Data Unit (PDU):
139 ingore syntax/access type, allow adding of non-leaf objects for GetPdu and
140 read-only objects to a SetPDU.
141 .It Fl b Ar buffersize
142 Tune the size of buffers used to send and receive packets.
143 The default size is 10000 bytes which should be enough unless an agent sends
144 a really large octetstring.
145 The maximum allowed length is 65535 according to the Structure of Management
148 The context to query with SNMPv3 PDUs.
152 Default is "" (empty).
153 .It Cm context-engine=engine-id
154 The SNMP Engine ID of the context to query with SNMPv3 PDUs, represented as
156 By default, this is set to the Engine ID of the SNMP agent.
159 Perform SNMP USM Engine Discovery, rather than sending a request for the value
160 of a specific object.
163 This option will cause the packets sent and received to be dumped to the
167 If an error is returned in the response PDU, resend the request removing the
168 variable that caused the error until a valid response is received.
169 This is only useful for a GetRequest- and a GetNextRequest-PDU.
171 Print a short help text with default values for various options.
173 Load each MIB description file from the given list to translate symbolic
174 object names to their numerical representation and vice versa.
175 Use the other options to obtain a non-default behaviour:
178 Specifies the initial OID that was cut by
180 when producing the MIB description file.
181 The default value is .iso(1).org(3).dod(6) which is what should have been
182 used for all the files installed under
183 .Pa /usr/share/snmp/defs .
184 Use this only if you generated your own files, providing a
189 The directory where files in the list will be searched.
191 .Pa /usr/share/snmp/defs Ns .
193 A comma separated list of files to which the two options above will apply.
196 The file suboption has to come after the other suboptions so that their
197 non-default values will be applied to the list of files.
198 The order of the other suboptions before each file suboption can be random.
199 Suboptions may be separated either by commas or by spaces.
200 If using spaces make sure the entire option string is one argument, for
201 example using quotes.
203 List of MIB description files produced by
210 will search to translate numerical OIDs to their symbolic object names.
211 Multiple files can be provided either giving this option multiple times
212 or a comma separated list of file names.
213 If a filename begins with a letter the default directory,
214 .Pa /usr/share/snmp/defs ,
217 Calculate and display the localized authentication and privacy keys
218 corresponding to a plain text password.
219 The password is obtained via the environment.
220 Additionally, if one or more OIDs are specified, the calculated
221 keys are used when processing the SNMPv3 requests.
223 The path of the posix local (unix domain) socket if local
225 .It Fl M Ar max-repetitions
226 The value for the max-repetitions field in a GetBulk PDU.
228 .It Fl N Ar non-repeaters
229 The value for the non-repeaters field in a GetBulk PDU.
232 Only use numerical representations for input and output OIDs and do not
233 try to resolve symbolic object names.
239 will print numerical OIDs anyway if the corresponding string representation
240 is not found in the MIB description files.
241 .It Fl o Ar [quiet|short|verbose]
242 The format used to print the received response.
243 Quiet only prints values, short (default) prints an abbreviated OID
244 representation and the value.
245 In addition to the short output verbose prints the type before the value.
247 Privacy options to use with SNMPv3 PDUs
249 .It Cm proto=[aes|des]
250 The protocol to use when encrypting/decrypting SNMPv3 PDU data.
252 A binary localized privacy key to use when encrypting/decrypting SNMPv3 PDU data.
255 By default plain text SNMPv3 PDUs are sent.
256 .It Fl p Ar [get|getnext|getbulk]
257 The PDU type to send by
266 Getbulk allows executing the so called SNMP "bulkwalks" allowing the values of
267 multiple columns to be retrieved in a single PDU by
270 Number of resends of request packets before giving up if the agent does
271 not respond after the first try.
273 .It Fl s Ar [trans::] Ns Ar [community@] Ns Ar [server] Ns Ar [:port]
274 Each of the server specification components is optional but at least one
275 has to be provided if the
278 The server specification is constructed in the following manner:
281 Transport type may be one of udp, stream or dgram.
282 If this option is not provided an UDP inet/inet6 socket will be used, which
284 Stream stands for a posix local stream socket and a posix local datagram
285 socket will be used if dgram is specified.
287 Specify an SNMP community string to be used when sending packets.
288 If the option is skipped the default "public" will be used for
292 and the default "private" community string will be used for
295 This might be either the IP address or the hostname where the agent is
300 The destination port to send the requests to.
301 This is useful if the SNMP agent listens on a non-default port.
302 Default is given by the
309 Number of seconds before resending a request packet if the agent does
311 The default value is 3 seconds.
313 User credentials when sending SNMPv3 PDUs.
316 The Engine ID of the SNMP agent represented as a binary octet string.
317 .It Cm engine-boots=value
318 The value of the snmpEngineBoots of the SNMP agent.
319 .It Cm engine-time=value
320 The value of the snmpEngineTime of the SNMP agent.
322 If any of the above is not specified, SNMP USM Engine Discovery is attempted.
323 This is also the default behavior.
325 The USM user name to include in the SNMPv3 PDUs.
326 By default, the user name is
327 obtained via the environment.
330 The SNMP protocol version to use when sending requests.
331 SNMP versions 1, 2 and
333 If no version option is provided
339 Note that GetBulkRequest-PDUs were introduced in SNMPv2 thus setting the
340 version to 1 is incompatible with sending a GetBulk PDU.
342 The object identifier whose value to retrieve.
343 At least one OID should be provided for
345 to be able to send a request.
349 this is the root object identifier of the subtree whose values are to be
351 If no OID is provided
353 will walk the mib2 subtree rooted
354 at .iso(1).org(3).dod(6).internet(1).mgmt(2).mib2(1) .
356 Any of the formats used to print a single variable
357 is valid as input OID:
359 .It 1.3.6.1.2.1.25.1.1.0
362 .It ifRcvAddressStatus.2.6.255.255.255.255.255.255
363 .It ifRcvAddressType[2,ff:ff:ff:ff:ff:ff]
364 .It ifRcvAddressStatus[Integer:1,OctetString:ff:ff:ff:ff:ff:ff]
370 Square brackets are used to denote an entry's indexes.
371 When used in an input OID, the square brackets may have to be
372 escaped or the OID has to be quoted to protect it from the shell.
373 Note there is no difference between ifName.1 and "ifName[1]".
374 .It OID Ns = Ns Ar [syntax Ns :] Ns Ar value
375 The object identifier with its syntax type and value that is to be set.
376 At least one such string OID=[syntax:]value should be provided to
378 to be able to send a request.
381 OID may be input as a string, a string followed by a random number of integers
382 (suboids) separated by dots, a sequence of integers separated by dots - that is
385 option is used - and in such case a syntax is required for every value,
386 or a string followed by square brackets (used to denote an entry's indexes) and
387 corresponding indexes.
388 Any of the formats used to print a single variable by
390 is valid as input OID as well:
392 .It 1.3.6.1.2.1.25.1.1.0=TimeTicks:537615486
393 .It sysLocation=OctetString:"@ Home" (with Fl o Ar verbose No option)
394 .It sysLocation.0="@ Home"
395 .It 1.3.6.1.2.1.2.2.1.6.1=OctetString:ffffffffffff
396 .It ifPhysAddress.1="00:02:b3:1d:1c:a3"
397 .It ifRcvAddressStatus.1.6.255.255.255.255.255.255=1
398 .It "ifRcvAddressStatus[Integer:1,OctetString:ff:ff:ff:ff:ff:ff]=Integer:1"
404 where the syntax string is one of:
405 Integer, OctetString, OID, IpAddress, Counter32, Gauge, TimeTicks, Counter64.
407 The value to be set - IP address in form of u.u.u.u - for example
408 1.3.1.6.1.2.0=IpAddress:192.168.0.1, strings require inverted-commas if they
409 contain any special characters or spaces, all other numeric types do not.
417 use the following environment variables:
418 .Bl -tag -width SNMPAUTH
420 Specifies a default SNMP USM authentication protocol.
422 Specifies a default SNMP USM privacy protocol.
424 Specifies a default SNMP USM user name.
426 Specifies the SNMP USM plain text password to use when calculating localized
427 authentication and privacy keys.
428 If this variable exists in the environment,
429 SNMPv3 is the default version to use for outgoing requests.
434 .An Shteryana Shopova Aq Mt syrinx@FreeBSD.org