version 1.7, 2019/10/03 11:02:26 |
version 1.8, 2019/10/26 17:43:52 |
|
|
.Nd simple SNMP client |
.Nd simple SNMP client |
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.Nm |
.Nm |
.Cm get | getnext |
.Cm get | getnext | bulkget |
.Op Fl A Ar authpass |
.Op Ar options |
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl O Cm afnQqSvx |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Ar agent |
.Ar agent |
.Ar oid ... |
.Ar oid ... |
.Nm |
.Nm |
.Cm walk |
.Cm walk | bulkwalk |
.Op Fl A Ar authpass |
.Op Ar options |
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl O Cm afnQqSvx |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Op Fl C Cm cIipt |
|
.Op Fl C Cm E Ar endoid |
|
.Ar agent |
.Ar agent |
.Op Ar oid |
.Op Ar oid |
.Nm |
.Nm |
.Cm bulkget |
|
.Op Fl A Ar authpass |
|
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl O Cm afnQqSvx |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Op Fl C Cm n Ns Ar nonrep Ns Cm r Ns Ar maxrep |
|
.Ar agent |
|
.Ar oid ... |
|
.Nm |
|
.Cm bulkwalk |
|
.Op Fl A Ar authpass |
|
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl O Cm afnQqSvx |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Op Fl C Cm cipn Ns Ar nonrep Ns Cm r Ns Ar maxrep |
|
.Ar agent |
|
.Op Ar oid |
|
.Nm |
|
.Cm set |
.Cm set |
.Op Fl A Ar authpass |
.Op Ar options |
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl O Cm afnQqSvx |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Ar agent |
.Ar agent |
.Ar varoid type value |
.Ar varoid type value |
.Oo Ar varoid type value Oc ... |
.Oo Ar varoid type value Oc ... |
.Nm |
.Nm |
.Cm trap |
.Cm trap |
.Op Fl A Ar authpass |
.Op Ar options |
.Op Fl a Ar digest |
|
.Op Fl c Ar community |
|
.Op Fl E Ar ctxengineid |
|
.Op Fl e Ar secengineid |
|
.Op Fl K Ar localpriv |
|
.Op Fl k Ar localauth |
|
.Op Fl l Ar seclevel |
|
.Op Fl n Ar ctxname |
|
.Op Fl r Ar retries |
|
.Op Fl t Ar timeout |
|
.Op Fl u Ar user |
|
.Op Fl v Ar version |
|
.Op Fl X Ar privpass |
|
.Op Fl x Ar cipher |
|
.Op Fl Z Ar boots , Ns Ar time |
|
.Ar agent uptime trapoid |
.Ar agent uptime trapoid |
.Oo Ar varoid type value Oc ... |
.Oo Ar varoid type value Oc ... |
.Nm |
.Nm |
.Cm mibtree |
.Cm mibtree |
.Op Fl O Cm fnS |
.Op Fl O Ar fns |
.Sh DESCRIPTION |
.Sh DESCRIPTION |
The |
The |
.Nm |
.Nm |
utility is a simple SNMP client. |
utility is a simple SNMP client. |
.Pp |
.Pp |
The subcommands are as follows: |
The subcommands are as follows: |
.Bl -tag -width bulkwalk |
.Bl -tag -width Ds |
.It Cm get |
.It Xo |
Retrieve the MIB for |
.Nm snmp |
|
.Cm get |
|
.Op Ar options |
|
.Ar agent oid ... |
|
.Xc |
|
Retrieve the varbind for |
.Ar oid |
.Ar oid |
from the |
from the |
.Ar agent . |
.Ar agent . |
If more than one |
If more than one |
.Ar oid |
.Ar oid |
is specified, retrieve the MIB for each one. |
is specified, retrieve the varbind for each one. |
.It Cm getnext |
.It Xo |
Retrieve the MIB that follows |
.Nm snmp |
|
.Cm getnext |
|
.Op Ar options |
|
.Ar agent oid ... |
|
.Xc |
|
Retrieve the varbind that follows |
.Ar oid |
.Ar oid |
from the |
from the |
.Ar agent . |
.Ar agent . |
If more than one |
If more than one |
.Ar oid |
.Ar oid |
is specified, retrieve the MIB following each one of them. |
is specified, retrieve the varbind following each one of them. |
.It Cm walk |
.It Nm snmp Cm walk Oo Ar options Oc Ar agent Op Ar oid |
Retrieve all the MIBs that are branches of |
Retrieve all the varbinds that are branches of |
.Ar oid |
.Ar oid |
from the |
from the |
.Ar agent . |
.Ar agent . |
This uses the |
This uses the |
.Cm getnext |
.Cm getnext |
subcommand internally and requests a single MIB at a time. |
subcommand internally and requests a single varbind at a time. |
If no OID is specified it defaults to mib-2 |
If no |
|
.Ar oid |
|
is specified it defaults to mib-2 |
.Pq .1.3.6.1.2.1 . |
.Pq .1.3.6.1.2.1 . |
.It Cm bulkget |
.It Xo |
Retrieve the next 10 MIBs following each |
.Nm snmp |
|
.Cm bulkget |
|
.Op Ar options |
|
.Ar agent Ar oid ... |
|
.Xc |
|
Retrieve the next 10 varbinds following each |
.Ar oid |
.Ar oid |
from the |
from the |
.Ar agent . |
.Ar agent . |
This command is not available for |
This command is not available for |
.Fl v Cm 1 . |
.Fl v Cm 1 . |
.It Cm bulkwalk |
.It Xo |
Retrieve all the MIBs from the |
.Nm snmp |
|
.Cm bulkwalk |
|
.Op Ar options |
.Ar agent |
.Ar agent |
|
.Op Ar oid |
|
.Xc |
|
Retrieve all the varbinds from the |
|
.Ar agent |
that are branches of |
that are branches of |
.Ar oid . |
.Ar oid . |
This uses the |
This uses the |
.Cm bulkget |
.Cm bulkget |
subcommand internally to retrieve multiple MIBs at a time. |
subcommand internally to retrieve multiple varbinds at a time. |
This command is not available for |
This command is not available for |
.Fl v Cm 1 . |
.Fl v Cm 1 . |
.It Cm set |
.It Xo |
Set one or more OIDs to a new value. |
.Nm snmp |
The triple |
.Cm set |
.Ar varoid , type , value |
.Op Ar options |
is described in |
.Ar agent varoid type value ... |
.Sx Data types . |
.Xc |
.It Cm trap |
Set one or more |
|
.Ar varoid to a new |
|
.Ar value . |
|
The format of the |
|
.Ar varoid type value |
|
triple is described in |
|
.Sx Data types , |
|
below. |
|
.It Xo |
|
.Nm snmp |
|
.Cm trap |
|
.Op Ar options |
|
.Ar agent uptime trapoid |
|
.Op Ar varoid type value ... |
|
.Xc |
Send a trap message to the |
Send a trap message to the |
.Ar agent . |
.Ar agent . |
The |
The |
|
|
The |
The |
.Ar trapoid |
.Ar trapoid |
is the identification OID used by the trap handler to determine its action. |
is the identification OID used by the trap handler to determine its action. |
The triple |
|
.Op Ar varoid , type , value |
|
is described in |
|
.Sx Data types . |
|
This command is not available for |
This command is not available for |
.Fl v Cm 1 . |
.Fl v Cm 1 . |
.It Cm mibtree |
.It Nm Cm mibtree Op Fl O Ar fnS |
Dump the tree of compiled-in MIB objects. |
Dump the tree of compiled-in MIB objects. |
.El |
.El |
.Pp |
.Pp |
The options are as follows: |
The |
|
.Ar options |
|
are as follows: |
.Bl -tag -width Ds |
.Bl -tag -width Ds |
.It Fl A Ar authpass |
.It Fl A Ar authpass |
The authentication password for the user. |
The authentication password for the user. |
|
|
This option is only used by |
This option is only used by |
.Fl v Cm 3 . |
.Fl v Cm 3 . |
.It Fl C Ar appopt |
.It Fl C Ar appopt |
Set the application specific |
For the |
|
.Cm bulkget , |
|
.Cm bulkwalk , |
|
and |
|
.Cm walk |
|
subcommands, set the application specific |
.Ar appopt |
.Ar appopt |
options by supplying a string of one or more |
options by supplying a string of one or more |
of the following modifier letters: |
of the following modifier letters: |
.Bl -tag -width Ds |
.Bl -tag -width Ds |
.It Cm c |
.It Cm c |
During a |
For |
.Cm walk |
.Cm walk |
or |
and |
.Cm bulkwalk , |
.Cm bulkwalk , |
disable checking the order of MIBs. |
disable checking the order of MIBs. |
On some devices that return MIBs out of order, |
On some devices that return MIBs out of order, |
this may cause an infinite loop. |
this may cause an infinite loop. |
.It Cm E Ar endoid |
.It Cm E Ar endoid |
Walk the tree up to but excluding |
For |
|
.Cm walk , |
|
walk the tree up to but excluding |
.Ar endoid . |
.Ar endoid . |
The blank before |
The blank before |
.Ar endoid |
.Ar endoid |
is mandatory. |
is mandatory. |
.It Cm I |
.It Cm I |
If no branches are found during a |
For |
.Cm walk , |
.Cm walk , |
do not fall back to returning the original MIB via a |
do not fall back to returning the original MIB via a |
.Cm get |
.Cm get |
request. |
request. |
.It Cm i |
.It Cm i |
Before starting a |
For |
.Cm walk |
.Cm walk |
or |
and |
.Cm bulkwalk , |
.Cm bulkwalk , |
always do a |
always do a |
.Cm get |
.Cm get |
|
|
.Ar oid |
.Ar oid |
first. |
first. |
.It Cm n Ns Ar nonrep |
.It Cm n Ns Ar nonrep |
|
For |
|
.Cm bulkget |
|
and |
|
.Cm bulkwalk , |
Set the non-repeaters field in the request to the non-negative integer |
Set the non-repeaters field in the request to the non-negative integer |
.Ar nonrep . |
.Ar nonrep . |
This causes the first |
This causes the first |
|
|
No blank is allowed before |
No blank is allowed before |
.Ar nonrep . |
.Ar nonrep . |
.It Cm p |
.It Cm p |
At the end of a |
For |
.Cm walk |
.Cm walk |
or |
or |
.Cm bulkwalk , |
.Cm bulkwalk , |
show a summary of the total variables received. |
also show a summary of the total variables received. |
.It Cm r Ns Ar maxrep |
.It Cm r Ns Ar maxrep |
Set the max-repetitions field in the request to the positive integer |
|
.Ar maxrep . |
|
For |
For |
.Cm bulkget |
.Cm bulkget |
or |
and |
.Cm bulkwalk |
.Cm bulkwalk , |
this determines the amount of MIBs to return for each specified OID. |
set the max-repetitions field in the request to the positive integer |
|
.Ar maxrep . |
|
This determines the amount of MIBs to return for each specified OID. |
This value defaults to 10. |
This value defaults to 10. |
No blank is allowed before |
No blank is allowed before |
.Ar maxrep . |
.Ar maxrep . |
.It Cm t |
.It Cm t |
Show how long it took to |
For |
.Cm walk |
.Cm walk , |
the entire tree. |
Show how long it took to walk the entire tree. |
.El |
.El |
.It Fl c Ar community |
.It Fl c Ar community |
Set the |
Set the |
|
|
.It Cm x |
.It Cm x |
Display the varbind string values as hexadecimal strings. |
Display the varbind string values as hexadecimal strings. |
.El |
.El |
|
.Pp |
|
The |
|
.Cm mibtree |
|
subcommand may only use the |
|
.Op Fl fnS |
|
output options; |
|
no output options are available for |
|
.Cm trap . |
.It Fl r Ar retries |
.It Fl r Ar retries |
Set the number of |
Set the number of |
.Ar retries |
.Ar retries |
|
|
The syntax for the |
The syntax for the |
.Ar agent |
.Ar agent |
argument is |
argument is |
.Oo Ar protocol : Oc Ns Ar address |
.Oo Ar protocol : Oc Ns Ar address , |
with the follwing forms: |
with the following format: |
.Bl -column udp6XXXtcp6X address -offset indent |
.Bl -column udp6XXXtcp6X address -offset indent |
.It Ar protocol Ta Ar address |
.It Ar protocol Ta Ar address |
.It Cm udp | tcp Ta Ar hostname Ns Oo Pf : Ar port Oc | |
.It Cm udp | tcp Ta Ar hostname Ns Oo Pf : Ar port Oc | |
|
|
.Cm udp |
.Cm udp |
and the default |
and the default |
.Ar port |
.Ar port |
is 161; except for the |
is 161, except for the |
.Nm snmp Cm trap |
.Cm trap |
command which uses 162. |
subcommand, which uses 162. |
.Cm udpv6 |
.Cm udpv6 |
and |
and |
.Cm udpipv6 |
.Cm udpipv6 |
|
|
and |
and |
.Ar value . |
.Ar value . |
Supported types are: |
Supported types are: |
.Bl -tag -width 1n |
.Bl -tag -width 1n -offset indent |
.It Cm a |
.It Cm a |
An IPv4 Address. |
An IPv4 Address. |
.It Cm b |
.It Cm b |