1
.\" Portions of this file are subject to the following copyright. See
2
.\" the Net-SNMP's COPYING file for more details and other copyrights
4
.\"/***********************************************************
5
.\" Copyright 1988, 1989 by Carnegie Mellon University
7
.\" All Rights Reserved
9
.\" Permission to use, copy, modify, and distribute this software and its
10
.\" documentation for any purpose and without fee is hereby granted,
11
.\" provided that the above copyright notice appear in all copies and that
12
.\" both that copyright notice and this permission notice appear in
13
.\" supporting documentation, and that the name of CMU not be
14
.\" used in advertising or publicity pertaining to distribution of the
15
.\" software without specific, written prior permission.
17
.\" CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18
.\" ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19
.\" CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20
.\" ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21
.\" WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22
.\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
24
.\" ******************************************************************/
25
.\" Portions of this file are copyrighted by:
26
.\" Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
27
.\" Use is subject to license terms specified in the COPYING file
28
.\" distributed with the Net-SNMP package.
29
.\" ******************************************************************/
30
.TH SNMPCMD 1 "09 Jan 2004" VVERSIONINFO "Net-SNMP"
33
snmpcmd - commands to communicate with a network entity using SNMP Requests.
36
[OPTIONS] AGENT [PARAMETERS]
38
This manual page describes the common options for the SNMP commands:
39
.BR snmpbulkget ", " snmpbulkwalk ", " snmpdelta ", " snmpget ", "
40
.BR snmpgetnext ", " snmpnetstat ", " snmpset ", " snmpstatus ", "
41
.BR snmptable ", " snmptest ", " snmptrap ",
42
.BR " snmpdf", " snmpusm ", " snmpwalk ". "
43
The command line applications use the SNMP protocol to communicate
44
with an SNMP capable network entity, an agent. Individual
45
applications typically (but not necessarily) take additional
46
parameters that are given after the agent specification. These
47
parameters are documented in the manual pages for each application.
51
.BI -a " authProtocol"
52
Set the authentication protocol (MD5|SHA) used for authenticated SNMPv3
53
messages. Overrides the defAuthType token in the
57
.BI -A " authPassword"
58
Set the authentication pass phrase used for authenticated SNMPv3
59
messages. Overrides the defAuthPassphrase token in the
61
file. It is insecure to specify pass phrases on the command line,
66
Set the community string for SNMPv1/v2c transactions.
67
Overrides the defcommunity token in the
72
Dump (in hexadecimal) the sent and received SNMP packets.
75
Turn on debugging output for the given
79
for extremely verbose output.
82
Set the authoritative (security) engineID used for SNMPv3 REQUEST
83
messages. It is typically not necessary to specify this, as it will
84
usually be discovered automatically.
87
Set the context engineID used for SNMPv3 REQUEST messages scopedPdu.
88
If not specified, this will default to the authoritative engineID.
91
Display a brief usage message and then exit.
94
Display a list of configuration file directives understood by the
95
command and then exit.
98
Specifies input parsing options. See
103
Set the securityLevel used for SNMPv3 messages
104
(noAuthNoPriv|authNoPriv|authPriv). Appropriate pass phrase(s) must
105
provided when using any level higher than noAuthNoPriv.
106
Overrides the defSecurityLevel token in the
111
Specifies output logging options. See
116
Specifies a colon separated list of MIB modules (not files) to load for
117
this application. This overrides the environment variable MIBS.
121
is used to specify all modules in all directories when searching for MIB
122
files. Every file whose name does not begin with "." will be parsed as
123
if it were a MIB file.
127
has a leading '+', then the listed MIB modules are loaded in
128
addition to MIB modules specified in the environment variable MIBS.
132
token is specified in the
141
Specifies a colon separated list of directories to search for MIBs.
142
This overrides the environment variable MIBDIRS.
146
has a leading '+', then the given directories are added to the list
147
of MIB directories. Without the leading '+', the
148
given directory list overrides the list specified with the
149
environment variable MIBDIRS. Note that the directories listed at the
150
end of the list have precedence over directories at the beginning
153
If no value is specified for the environment variable MIBDIRS,
154
then the command will still search a default mib directory,
155
after it searches the MIB directories specified on the -M
156
option. The default directory is DATADIR/snmp/mibs.
157
To avoid having a default mib directory searched, set the
158
MIBDIRS environment variable to "". Even if the default
159
MIB directory is searched, the directories specified in the
160
-M option have precedence in the search order over the
163
If the -M option is specified and either a mibfile or mibdirs token
164
is also specified in the
166
file, the directories in the
167
-M option have precedence in the MIB search order, over the
168
directories set with both the mibdirs token and the mibfile token.
170
.BI -n " contextName"
171
Set the destination contextName used for SNMPv3 messages. The default
172
contextName is the empty string "". Overrides the defContext token
177
.BI -O " [abeEfnqQsStTuUvxX]"
178
Specifies output printing options. See
183
Specifies MIB parsing options. See
184
.B MIB PARSING OPTIONS
188
Specifies the number of retries to be used in the requests. The default
192
Specifies the timeout in seconds between retries. The default is 1.
195
Set the securityName used for authenticated SNMPv3 messages.
196
Overrides the defSecurityName token in the
200
.B -v \fI1\fR | \fI2c\fR | \fI3
201
Specifies the protocol version to use: 1 (RFCs 1155-1157), 2c (RFCs 1901-1908),
202
or 3 (RFCs 2571-2574). The default is typically version 3. This option
203
overrides the defVersion token in the
208
Display version information for the application and then exit.
210
.BI -x " privProtocol"
211
Set the privacy protocol (DES) used for encrypted SNMPv3 messages.
213
.BI -X " privPassword"
214
Set the privacy pass phrase used for encrypted SNMPv3 messages.
215
Overrides the defPrivPassphrase token in the
218
It is insecure to specify pass phrases on the command line, see
222
Set the engineBoots and engineTime used for authenticated SNMPv3
223
messages. This will initialize the local notion of the agents
224
boots/time with an authenticated value stored in the LCD.
225
It is typically not necessary to specify this option, as these values
226
will usually be discovered automatically.
228
.SH AGENT SPECIFICATION
234
above specifies the remote SNMP entity with which to communicate.
235
This specification takes the form:
237
[<transport-specifier>:]<transport-address>
241
specification may consist of a hostname, or an IPv4 address in the
242
standard "dotted quad" notation. In this case, communication will be
243
attempted using UDP/IPv4 to port 161 of the given host. Otherwise,
244
the <transport-address> part of the specification is parsed according
245
to the following table:
248
.BR "<transport-specifier>"
249
.BR "<transport-address> format"
261
[network]:node[/port]
263
.IR "" "aal5pvc " or " pvc"
264
[interface.][VPI.]VCI
265
.IP "udp6 or udpv6 or udpipv6" 28
270
'['IPv6-address']'[:port]
271
.IP "tcp6 or tcpv6 or tcpipv6"
276
'['IPv6-address']'[:port]
279
Note that <transport-specifier> strings are case-insensitive so that,
280
for example, "tcp" and "TCP" are equivalent. Here are some examples,
281
along with their interpretation:
284
perform query using UDP/IPv4 datagrams to
288
The ":161" is redundant here since that is the default SNMP port in
292
identical to the previous specification. The "udp:" is redundant here
293
since UDP/IPv4 is the default transport.
295
.IR "TCP:hostname:1161"
300
using TCP/IPv4 and perform query over that connection.
302
.IR "ipx::00D0B7AAE308"
303
perform query using IPX datagrams to node number
305
on the default network, and using the default IPX port of 36879 (900F
306
hexadecimal), as suggested in RFC 1906.
308
.IR "ipx:0AE43409:00D0B721C6C0/1161"
309
perform query using IPX datagrams to port
316
.IR "unix:/tmp/local-agent"
317
connect to the Unix domain socket
318
.IR /tmp/local-agent ,
319
and perform the query over that connection.
321
.IR "/tmp/local-agent"
322
identical to the previous specification, since the Unix domain is the
323
default transport iff the first character of the <transport-address>
327
perform the query using AAL5 PDUs sent on the permanent virtual
328
circuit with VPI=0 and VCI=100 (decimal) on the first ATM adapter in the
332
perform the query using AAL5 PDUs sent on the permanent virtual
333
circuit with VPI=10 (decimal) and VCI=32 (decimal) on the second ATM
334
adapter in the machine. Note that "PVC" is a synonym for "AAL5PVC".
336
.IR "udp6:hostname:10161"
337
perform the query using UDP/IPv6 datagrams to port
341
(which will be looked up as an AAAA record).
343
.IR "UDP6:[fe80::2d0:b7ff:fe21:c6c0]"
344
perform the query using UDP/IPv6 datagrams to port 161 at address
345
.IR fe80::2d0:b7ff:fe21:c6c0 .
347
.IR "tcpipv6:[::1]:1611"
348
connect to port 1611 on the local host
350
in IPv6 parlance) using TCP/IPv6 and perform query over that connection.
352
Note that not all the transport domains listed above will always be
353
available; for instance, hosts with no IPv6 support will not be able
354
to use udp6 transport addresses, and attempts to do so will result in
355
the error "Unknown host". Likewise, since AAL5 PVC support is only
356
currently available on Linux, it will fail with the same error on
359
.SH "MIB PARSING OPTIONS"
360
The Net-SNMP MIB parser mostly adheres to the Structure of Management
361
Information (SMI). As that specification has changed through time, and
362
in recognition of the (ahem) diversity in compliance expressed in MIB
363
files, additional options provide more flexibility in reading MIB files.
366
Show some warning messages in resolving the MIB files.
367
Can be also set with the configuration token "mibWarningLevel".
370
Show additional warning messages.
371
Can be also set with the configuration token "mibWarningLevel".
375
Can be also set with the configuration token "showMibErrors".
376
An example of an error that would be shown is if an imported
377
module is not found during MIB parsing.
380
Allow ASN.1 comment to extend to the end of the MIB source line
381
(i.e. disallow the use of "--" to terminate comments).
382
This overcomes some problems with manually maintained MIB files.
383
Can be also set with the configuration token "strictCommentTerm".
386
Toggles the default of whether or not to save the DESCRIPTIONs
387
of the MIB objects when parsing. Since the default is to save
388
the DESCRIPTIONS, specifying -Pd will cause the DESCRIPTIONs not
389
to be saved during MIB parsing. For example:
391
snmptranslate -Td -OS -IR system.sysDescr.0
393
will show a description, while
395
snmptranslate -Td -OS -IR -Pd system.sysDescr.0
397
will not show a description. Collecting the
398
DESCRIPTION information into the parsed hierarchy
399
increases the memory used by the size of each DESCRIPTION clause.
402
Allow underline characters in symbols.
403
Can be also set with the configuration token "mibAllowUnderline".
406
Replace MIB objects using the last read MIB file.
407
The parser will replace MIB objects in its hierarchy whenever
408
it sees a sub-identifier and name match.
410
Setting this option may result in an incorrect hierarchy.
411
Can be also set with the configuration token "mibReplaceWithLatest".
414
Output display can be controlled by passing various parameters to the
416
flag. The following examples should demonstrate this.
418
The default output looks as follows:
420
snmpget -c public -v 1 localhost system.sysUpTime.0
422
SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
425
Removes the equal sign and type information:
427
system.sysUpTime.0 1:15:09:27.63
430
Removes the type information:
432
system.sysUpTime.0 = 1:15:09:27.63
435
Gives you the complete OID:
437
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
440
Deletes all but the last symbolic part of the OID:
442
sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
447
that adds the name of the MIB that defined the object:
449
SNMPv2-MIB::sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
451
(from release 5.0, this is now the default output format)
454
Prints the OID in the UCD-style (inherited from the original CMU code),
455
That means removing a series of "standard" prefixes, if relevant,
456
and breaking down the OID into the displayable pieces. For example,
457
the OID vacmSecruityModel.0.3.119.101.115 is broken down by default
458
and the string hidden in the OID is shown. The result would
459
look like: vacmSecurityModel.0."test". The -Ob option disables this
462
system.sysUpTime.0 = Timeticks: (14096763) 1 day, 15:09:27.63
465
Prints the OID numerically:
467
.1.3.6.1.2.1.1.3.0 = Timeticks: (14096763) 1 day, 15:09:27.63
470
Removes the symbolic labels from enumerations:
472
snmpget -c public -v 1 localhost ip.ipForwarding.0
474
ip.ipForwarding.0 = INTEGER: forwarding(1)
476
snmpget -c public -v 1 -Oe localhost ip.ipForwarding.0
478
ip.ipForwarding.0 = INTEGER: 1
481
When OIDs contain a index to a table,
482
they are broken into the displayable pieces and shown to you. For
483
example the OID vacmSecurityModel.0.3.119.101.115 is nicely broken
484
down by default and the string hidden in the OID is shown to you as
485
vacmSecurityModel.0."wes".
488
option disables this feature and displays it as
489
vacmSecurityModel.0.3.119.101.115 again.
492
This modifies the index strings to include a \\ to escape the quotes,
493
to allow them to be reused in shell commands, such as
494
vacmSecurityModel.0.\\"wes\\"
497
This modifies the output of index OIDs, to look more "program like".
498
Square brackets are placed around each index, and the DISPLAY-HINT
499
information and string conversions are used to format each index.
500
If you take an entry from the IPV6-MIB::ipv6RouteTable, it is indexed with
501
an IPv6 address and two integers, and if you are used to IPv6 addresses
502
you will know that decimal OIDs are not the preferred notation. Compare:
504
snmpgetnext -OS host IPV6-MIB:ipv6RouteTable
506
IPV6-MIB::ipv6RouteIfIndex.63.254.1.0.255.0.0.0.0.0.0.0.0.0.0.0.64.1 = INTEGER: 2
508
snmpgetnext -OSX host IPV6-MIB:ipv6RouteTable
510
IPV6-MIB::ipv6RouteIfIndex[3ffe:100:ff00:0:0:0:0:0][64][1] = INTEGER: 2
513
If a string-valued object definition does not include a Display Hint,
514
then the library attempts to determine whether it is an ascii or
515
binary string, and displays the value accordingly.
516
This flag bypasses this check, and displays all strings as ASCII.
517
Note that this does not affect objects that do have a Display Hint.
520
This works similarly to '-Oa', but displays strings as Hex.
523
If hexadecimal code is printed, this will also print any printable
524
characters after the hexadecimal codes.
527
Output only the variable value, not the OID:
529
snmpget -c public -v 1 -Ov localhost ip.ipForwarding.0
531
INTEGER: forwarding(1)
534
Do not print the UNITS suffix at the end of the value.
537
Output timeticks values as raw numbers:
539
system.sysUpTime.0 = 14096763
541
Note that most of these options can be turned on or off by default by
546
manual page for details.
548
.SH "LOGGING OPTIONS"
549
The mechanism and destination to use for logging of warning and error
550
messages can be controlled by passing various parameters to the
555
Log messages to the standard error stream.
558
Log messages to the specified file.
561
Log messages to the standard output stream.
564
Log messages via syslog, using the specified facility
565
('d' for LOG_DAEMON, 'u' for LOG_USER,
566
or '0'-'7' for LOG_LOCAL0 through LOG_LOCAL7).
569
There are also "upper case" versions of each of these options, which
570
allow the corresponding logging mechanism to be restricted to certain
571
priorities of message. Using standard error logging as an example:
574
will log messages of priority 'pri' and above to standard error.
577
will log messages with priority between 'p1' and 'p2' (inclusive) to
584
the priority specification comes before the file or facility token.
585
The priorities recognised are:
627
Normal output is (or will be!) logged at a priority level of
633
flag specifies various options that control how your input to
634
the program is parsed. By default, all input parsing methods are
635
used: First the OID is parsed regularly, then
639
is used, unless one of the following flags is specified which will
640
force it to only use one method.
645
flag specifies random access lookup, so that if the entire OID path is
646
not specified, it will search for a node in the MIB tree with the given
647
name. Normally, you would have to specify the vacmSecurityModel OID above
648
as .iso.org.dod.internet.snmpV2.snmpModules.snmpVacmMIB.vacmMIBObjects.vacmSecurityToGroupTable.vacmSecurityToGroupEntry.vacmSecurityModel.0."wes",
651
flag allows you to shorten that to just vacmSecurityModel.0."wes".
652
(Though this OID really needs to be quoted - 'vacmSecurityModel.0."wes"' - to
653
prevent the shell from swallowing the double quotes).
655
Additionally, see the
656
.B RANDOM ACCESS MIBS
662
flag indicates that the expression you gave it is actually a regular
663
expression that should be used to search for the best match possible in
664
the MIB tree. This would allow you to specify the node
665
vacmSecurityModel MIB node as something as generic as vacmsecuritymodel
666
(since case insensitive searches are done) or vacm.*model. Note that
667
multiple matches are obviously possible (.* matches everything), and the
668
best result is currently calculated as the one that matches the closest
669
to the beginning of the node name and the highest in the tree. A
670
current side effect of this option is that you cannot specify indexes
671
or multiple nodes, since the '.' is treated as part of the regular
675
Use the traditional UCD-style input approach of assuming that OIDs
676
are rooted at the 'mib-2' point in the tree (unless they start with
677
an explicit '.') If random access lookup is in effect (which is
678
the default for most commands), then this will only affect OIDs
679
specified with a leading numberic subidentifier (and no initial '.')
680
Thus an input of "snmpcmd ... 1" would refer to 'iso' (from v5.0
681
onwards) while "snmpcmd -Iu ... 1" would refer to 'system'.
684
By default, indices into tables and values to be assigned to objects
685
are checked against range and type specified in the MIB. The
687
flag disables this check. This flag is mostly useful when you are
688
testing an agent. For normal operation it is useful to get your
689
requests checked before they are sent to the remote agent (the
690
diagnostic that the library can provide is also much more precise).
693
By default, the library will use DISPLAY-HINT information when assigning values.
694
This flag disables this behaviour. The result is that instead of
696
snmpset localhost HOST-RESOURCES-MIB::hrSystemDate.0 = 2002-12-10,2:4:6.8
698
you will have to write
700
snmpset localhost HOST-RESOURCES-MIB::hrSystemData.0 x "07 D2 0C 0A 02 04 06 08"
703
Add the specified suffix to each textual OID given on the command line.
704
It is useful to specify a common index value when you want to retrieve
705
multiple objects from the same row of a table.
708
Add the specified prefix to each textual OID given on the command line.
709
Useful to specify an explicit MIB module name for all objects being retrieved
710
(or for incurably lazy typists)
712
.SH "RANDOM ACCESS MIBS"
713
In previous releases of the UCD-SNMP package (and if using the
715
option), an object identifier such as system.sysDescr.0 will be
716
lookup in a single "well known" place, built into the SNMP library (or
717
specified by the P@REFIX environment variable). The standard place
718
is: .iso.org.dod.internet.mgmt.mib-2. The identifier may alternatively be
719
a complete object identifier, this is designated by a leading "dot"
720
if using UCD-input style, and is the first thing tried otherwise.
721
To simplify the specification of object identifiers the library
722
supports random access to the identifiers in the MIBs. This is
725
option to the SNMP applications. Additionally,
727
prints OIDs in this manner. Using this, system.sysDescr.0 may
728
also be entered as sysDescr.0. To search only a single MIB for the
729
identifier (if it appears in more than one), specify it as
730
SNMPv2-MIB::sysDescr.0. (use
732
to print output OIDs in this manner, though this is the default as
733
from v5.0). This notation will also ensure
734
that the specified MIB is loaded, i.e. it need not be mentioned in the
736
option (or MIBS environment variable).
738
.SH "ENVIRONMENT VARIABLES"
740
The standard prefix for object identifiers (if using UCD-style output).
741
Defaults to .iso.org.dod.internet.mgmt.mib-2
743
The list of MIBs to load. Defaults to
744
SNMPv2-TC:SNMPv2-MIB:IF-MIB:IP-MIB:TCP-MIB:UDP-MIB:SNMP-VACM-MIB.
749
The list of directories to search for MIBs. Defaults to DATADIR/snmp/mibs.
755
.IP SYSCONFDIR/snmp/snmpd.conf
756
Agent configuration file. See
758
.IP SYSCONFDIR/snmp/snmp.conf
759
.IP ~/.snmp/snmp.conf
760
Application configuration files. See
764
snmpget(1), snmpgetnext(1), snmpset(1),
765
snmpbulkget(1), snmpbulkwalk(1), snmpwalk(1),
766
snmptable(1), snmpnetstat(1), snmpdelta(1), snmptrap(1), snmpinform(1),
767
snmpusm(1), snmpstatus(1), snmptest(1),