Blame man/snmptrapd.conf.5.def

Packit fcad23
.TH SNMPTRAPD.CONF 5 "13 Mar 2014" VVERSIONINFO "Net-SNMP"
Packit fcad23
.SH NAME
Packit fcad23
snmptrapd.conf - configuration file for the Net-SNMP notification receiver
Packit fcad23
.SH DESCRIPTION
Packit fcad23
The Net-SNMP notification receiver (trap daemon) uses one or more
Packit fcad23
configuration files to control its operation and how incoming traps
Packit fcad23
(and INFORM requests) should be processed.
Packit fcad23
This file (\fBsnmptrapd.conf\fR) can be located in
Packit fcad23
one of several locations, as described in the
Packit fcad23
.IR snmp_config (5)
Packit fcad23
manual page.
Packit fcad23
.SH IMPORTANT
Packit fcad23
Previously,
Packit fcad23
.B snmptrapd
Packit fcad23
would accept all incoming notifications, and log them automatically
Packit fcad23
(even if no explicit configuration was provided).
Packit fcad23
Starting with release 5.3, access control checks will be applied to
Packit fcad23
incoming notifications. If
Packit fcad23
.B snmptrapd
Packit fcad23
is run without a suitable configuration file (or equivalent access
Packit fcad23
control settings), then such traps \fBWILL NOT\fR
Packit fcad23
be processed.
Packit fcad23
See the section \fBACCESS CONTROL\fR for more details.
Packit fcad23
.PP
Packit fcad23
As with the agent configuration, the
Packit fcad23
.I snmptrapd.conf
Packit fcad23
directives can be divided into four distinct groups.
Packit fcad23
.SH TRAPD BEHAVIOUR
Packit fcad23
.IP "snmpTrapdAddr [<transport-specifier>:]<transport-address>[,...]"
Packit fcad23
defines a list of listening addresses, on which to receive
Packit fcad23
incoming SNMP notifications.
Packit fcad23
See the section 
Packit fcad23
.B LISTENING ADDRESSES
Packit fcad23
in the
Packit fcad23
.IR snmpd (8)
Packit fcad23
manual page for more information about the format of listening
Packit fcad23
addresses.
Packit fcad23
.IP
Packit fcad23
The default behaviour is to
Packit fcad23
listen on UDP port 162 on all IPv4 interfaces.
Packit fcad23
.IP "doNotRetainNotificationLogs yes"
Packit fcad23
disables support for the NOTIFICATION\-LOG\-MIB.
Packit fcad23
Normally the snmptrapd program keeps a record of the traps
Packit fcad23
received, which can be retrieved by querying
Packit fcad23
the \fCnlmLogTable\fR and \fCnlmLogvariableTable\fR tables.  
Packit fcad23
This directive can be used to suppress this behaviour.
Packit fcad23
.IP
Packit fcad23
See the 
Packit fcad23
.IR snmptrapd (8) 
Packit fcad23
manual page and the NOTIFICATION\-LOG\-MIB for details.
Packit fcad23
.IP "doNotLogTraps yes"
Packit fcad23
disables the logging of notifications altogether.
Packit fcad23
This is useful if the \fBsnmptrapd\fR application should
Packit fcad23
only run traphandle hooks and should not log traps to any location.
Packit fcad23
.IP "doNotFork yes"
Packit fcad23
do not fork from the calling shell.
Packit fcad23
.IP "pidFile PATH"
Packit fcad23
defines a file in which to store the process ID of the
Packit fcad23
notification receiver.  By default, this ID is not saved.
Packit fcad23
.SH ACCESS CONTROL
Packit fcad23
Starting with release 5.3, it is necessary to explicitly specify
Packit fcad23
who is authorised to send traps and informs to the notification
Packit fcad23
receiver (and what types of processing these are allowed to trigger).
Packit fcad23
This uses an extension of the VACM model, used in the main SNMP agent.
Packit fcad23
.PP
Packit fcad23
There are currently three types of processing that can be specified:
Packit fcad23
.RS
Packit fcad23
.IP "log"
Packit fcad23
log the details of the notification - either in a specified file,
Packit fcad23
to standard output (or stderr), or via \fIsyslog\fR (or similar).
Packit fcad23
.IP "execute"
Packit fcad23
pass the details of the trap to a specified handler program, including
Packit fcad23
embedded perl.
Packit fcad23
.IP "net"
Packit fcad23
forward the trap to another notification receiver.
Packit fcad23
.RE
Packit fcad23
.PP
Packit fcad23
In the following directives, \fITYPES\fR will be a (comma-separated)
Packit fcad23
list of one or more of these tokens.  Most commonly, this will
Packit fcad23
typically be \fIlog,execute,net\fR to cover any style of processing
Packit fcad23
for a particular category of notification. But it is perfectly
Packit fcad23
possible (even desirable) to limit certain notification sources to
Packit fcad23
selected processing only.
Packit fcad23
.IP "authCommunity   TYPES COMMUNITY  [SOURCE [OID | \-v VIEW ]]"
Packit fcad23
authorises traps (and SNMPv2c INFORM requests) with the specified
Packit fcad23
community to trigger the types of processing listed.
Packit fcad23
By default, this will allow any notification using this community
Packit fcad23
to be processed.  The SOURCE field can be used to specify that the
Packit fcad23
configuration should only apply to notifications received from
Packit fcad23
particular sources - see
Packit fcad23
.IR snmpd.conf (5)
Packit fcad23
for more details.
Packit fcad23
.IP "authUser   TYPES [\-s MODEL] USER  [LEVEL [OID | \-v VIEW ]]"
Packit fcad23
authorises SNMPv3 notifications with the specified
Packit fcad23
user to trigger the types of processing listed.
Packit fcad23
By default, this will accept authenticated requests.
Packit fcad23
(\fIauthNoPriv\fR or \fIauthPriv\fR). The LEVEL field can
Packit fcad23
be used to allow unauthenticated notifications (\fInoauth\fR),
Packit fcad23
or to require encryption (\fIpriv\fR), just as for the SNMP agent.
Packit fcad23
.IP
Packit fcad23
With both of these directives, the OID (or \fI\-v VIEW\fR) field
Packit fcad23
can be used to retrict this configuration to the processing of
Packit fcad23
particular notifications.
Packit fcad23
.RS
Packit fcad23
.IP "Note:"
Packit fcad23
Unlike the VACM processing described in RFC 3415, this view is
Packit fcad23
\fBonly\fR matched against the \fCsnmpTrapOID\fR value of the
Packit fcad23
incoming notification.  It is not applied to the payload varbinds
Packit fcad23
held within that notification.
Packit fcad23
.RE
Packit fcad23
.IP "authGroup  TYPES [\-s MODEL] GROUP  [LEVEL [OID | \-v VIEW ]]"
Packit fcad23
.IP "authAccess TYPES [\-s MODEL] GROUP VIEW  [LEVEL [CONTEXT]]"
Packit fcad23
.IP "setAccess GROUP CONTEXT MODEL LEVEL PREFIX VIEW TYPES"
Packit fcad23
authorise notifications in the specified GROUP
Packit fcad23
(configured using the \fIgroup\fR directive)
Packit fcad23
to trigger the types of processing listed.
Packit fcad23
See
Packit fcad23
.IR snmpd.conf (5)
Packit fcad23
for more details.
Packit fcad23
.IP "createUser [-e  ENGINEID] username (MD5|SHA|SHA-512|SHA-384|SHA-256|SHA-224) authpassphrase [DES|AES]"
Packit fcad23
See the 
Packit fcad23
.IR snmpd.conf (5)
Packit fcad23
manual page for a description of how to create SNMPv3 users.  This
Packit fcad23
is roughly the same, but the file name changes to snmptrapd.conf from
Packit fcad23
snmpd.conf.
Packit fcad23
.IP "disableAuthorization yes"
Packit fcad23
will disable the above access control checks, and revert to the
Packit fcad23
previous behaviour of accepting all incoming notifications.
Packit fcad23
.IP
Packit fcad23
.\" XXX - Explain why this is a Bad Idea
Packit fcad23
.\"
Packit fcad23
.SH LOGGING
Packit fcad23
.IP "format1 FORMAT"
Packit fcad23
.IP "format2 FORMAT"
Packit fcad23
specify the format used to display SNMPv1 TRAPs and SNMPv2
Packit fcad23
notifications respectively.  Note that SNMPv2c and SNMPv3
Packit fcad23
both use the same SNMPv2 PDU format.
Packit fcad23
.IP "format DESTINATION FORMAT"
Packit fcad23
specify the format used for different destinations.
Packit fcad23
DESTINATION is one of:
Packit fcad23
.IR print ", " print1 ", " print2 ", " 
Packit fcad23
.IR syslog ", " syslog1 ", " syslog2 ", " 
Packit fcad23
.IR execute ", " execute1 ", " execute2 .
Packit fcad23
.I print1
Packit fcad23
is used for printing SNMPv1 traps,
Packit fcad23
.I print2
Packit fcad23
is for SNMPv2.
Packit fcad23
.I print
Packit fcad23
is used for both versions.
Packit fcad23
.I syslog
Packit fcad23
is similarly used when sending traps to syslog, and
Packit fcad23
.I execute
Packit fcad23
used when sending traps to a program such as
Packit fcad23
.IR traptoemail (1).
Packit fcad23
.IP
Packit fcad23
The default formats are
Packit fcad23
.br
Packit fcad23
.I format print1 %.4y-%.2m-%.2l %.2h:%.2j:%.2k %B [%b] (via %A [%a]): %N\en\et%W Trap (%q) Uptime: %#T\en%v\en
Packit fcad23
.br
Packit fcad23
.I format print2 %.4y-%.2m-%.2l %.2h:%.2j:%.2k %B [%b]:\en%v\en
Packit fcad23
.br
Packit fcad23
.I format syslog1 %a: %W Trap (%q) Uptime: %#T%#v\en
Packit fcad23
.br
Packit fcad23
.I format syslog2 %B [%b]: Trap %#v\en
Packit fcad23
.br
Packit fcad23
.I format execute %B\en%b\en%V\en%v\en
Packit fcad23
.IP
Packit fcad23
See
Packit fcad23
.IR snmptrapd (8)
Packit fcad23
for the layout characters available.
Packit fcad23
.IP "ignoreAuthFailure yes"
Packit fcad23
instructs the receiver to ignore \fIauthenticationFailure\fR traps.
Packit fcad23
.RS
Packit fcad23
.IP Note:
Packit fcad23
This currently only affects the logging of such notifications.
Packit fcad23
\fIauthenticationFailure\fR traps will still be passed to trap
Packit fcad23
handler scripts, and forwarded to other notification receivers.
Packit fcad23
This behaviour should not be relied on, as it is likely
Packit fcad23
to change in future versions.
Packit fcad23
.RE
Packit fcad23
.IP "logOption string"
Packit fcad23
specifies where notifications should be logged - to standard
Packit fcad23
output, standard error, a specified file or via \fIsyslog\fR.
Packit fcad23
See the section LOGGING OPTIONS in the
Packit fcad23
.IR snmpcmd (1)
Packit fcad23
manual page for details.
Packit fcad23
.IP "outputOption string"
Packit fcad23
specifies various characteristics of how OIDs and other values
Packit fcad23
should be displayed.
Packit fcad23
See the section OUTPUT OPTIONS in the
Packit fcad23
.IR snmpcmd (1)
Packit fcad23
manual page for details.
Packit fcad23
.SH MySQL Logging
Packit fcad23
There are two configuration variables that work together to control
Packit fcad23
when queued traps are logged to the MySQL database. A non-zero
Packit fcad23
value must be specified for sqlSaveInterval to enable MySQL logging.
Packit fcad23
.RE
Packit fcad23
.IP "sqlMaxQueue max"
Packit fcad23
specifies the maximum number of traps to queue before a forced flush
Packit fcad23
to the MySQL database.
Packit fcad23
.RE
Packit fcad23
.IP "sqlSaveInterval seconds"
Packit fcad23
specified the number of seconds between periodic queue flushes.
Packit fcad23
A value of 0 for will disable MySQL logging.
Packit fcad23
.SH NOTIFICATION PROCESSING
Packit fcad23
As well as logging incoming notifications, they can also
Packit fcad23
be forwarded on to another notification receiver, or passed
Packit fcad23
to an external program for specialised processing.
Packit fcad23
.IP "traphandle OID|default PROGRAM [ARGS ...]"
Packit fcad23
invokes the specified program (with the given arguments) whenever a
Packit fcad23
notification is received that matches the OID token.  For SNMPv2c and
Packit fcad23
SNMPv3 notifications, this token will be compared against the
Packit fcad23
\fCsnmpTrapOID\fR value taken from the notification.  For SNMPv1 traps,
Packit fcad23
the generic and specific trap values and the enterprise OID will be
Packit fcad23
converted into the equivalent OID (following RFC 2576).
Packit fcad23
.IP
Packit fcad23
Typically, the OID token will be the name (or numeric OID) of a
Packit fcad23
NOTIFICATION-TYPE object, and the specified program will be invoked for
Packit fcad23
notifications that match this OID exactly.  However this token also
Packit fcad23
supports a simple form of wildcard suffixing.  By appending the character
Packit fcad23
\'*' to the OID token, the corresponding program will be invoked for any
Packit fcad23
notification based within subtree rooted at the specified OID.
Packit fcad23
For example, an OID token of \fC.1.3.6.1.4.1*\fP would match any enterprise
Packit fcad23
specific notification (including the specified OID itself).
Packit fcad23
An OID token of \fC.1.3.6.1.4.1.*\fP would would work in much the same way,
Packit fcad23
but would not match this exact OID - just notifications that lay strictly
Packit fcad23
below this root.
Packit fcad23
Note that this syntax does not support full regular expressions or
Packit fcad23
wildcards - an OID token of the form \fCoid.*.subids\fR is \fBnot\fC valid.
Packit fcad23
.IP
Packit fcad23
If the OID field is the token \fIdefault\fR then the program will be
Packit fcad23
invoked for any notification not matching another (OID specific)
Packit fcad23
\fItraphandle\fR entry.
Packit fcad23
.PP
Packit fcad23
Details of the notification are fed to the program via its standard input.
Packit fcad23
Note that this will always use the SNMPv2-style notification format, with
Packit fcad23
SNMPv1 traps being converted as per RFC 2576, before being passed to the
Packit fcad23
program.
Packit fcad23
The input format is, if you use the default set by
Packit fcad23
the "format execute %B\en%b\en%V\en%v\en", one entry per line:
Packit fcad23
.RS
Packit fcad23
.IP HOSTNAME
Packit fcad23
The name of the host that sent the notification, as determined by
Packit fcad23
.IR gethostbyaddr (3).
Packit fcad23
.br
Packit fcad23
.IP ADDRESS
Packit fcad23
The transport address, like
Packit fcad23
.br
Packit fcad23
"[UDP: [172.16.10.12]:23456->[10.150.0.8]]"
Packit fcad23
.\"
Packit fcad23
.\" XXX - What about non-IPv4 transports?
Packit fcad23
.\"
Packit fcad23
.IP VARBINDS
Packit fcad23
A list of variable bindings describing the contents of the notification,
Packit fcad23
one per line.  The first token on each line (up until a space) is the
Packit fcad23
OID of the varind, and the remainder of the line is its value.
Packit fcad23
The format of both of these are controlled by the \fIoutputOption\fR
Packit fcad23
directive (or similar configuration).
Packit fcad23
.IP
Packit fcad23
The first OID should always be \fCSNMPv2\-MIB::sysUpTime.0\fR,
Packit fcad23
and the second should be \fCSNMPv2\-MIB::snmpTrapOID.0\fR.
Packit fcad23
The remaining lines will contain the payload varbind list.
Packit fcad23
For SNMPv1 traps, the final OID will be \fCSNMPv2\-MIB::snmpTrapEnterprise.0\fR.
Packit fcad23
.br
Packit fcad23
.IP Example:
Packit fcad23
A \fBtraptoemail\fR script has been included in the Net-SNMP package that
Packit fcad23
can be used within a \fItraphandle\fR directive:
Packit fcad23
.br
Packit fcad23
.RS
Packit fcad23
.P
Packit fcad23
traphandle default /usr/bin/perl BINDIR/traptoemail \-s mysmtp.somewhere.com \-f admin@somewhere.com me@somewhere.com
Packit fcad23
.RE
Packit fcad23
.RE
Packit fcad23
.IP "forward OID|default DESTINATION"
Packit fcad23
forwards notifications that match the specified OID
Packit fcad23
to another receiver listening on DESTINATION.
Packit fcad23
The interpretation of OID (and \fIdefault\fR) is the same
Packit fcad23
as for the \fItraphandle\fR directive).
Packit fcad23
.IP
Packit fcad23
See the section 
Packit fcad23
.B LISTENING ADDRESSES
Packit fcad23
in the
Packit fcad23
.IR snmpd (8)
Packit fcad23
manual page for more information about the format of listening
Packit fcad23
addresses.
Packit fcad23
.RE
Packit fcad23
.SH NOTES
Packit fcad23
.IP o
Packit fcad23
The daemon blocks while executing the \fItraphandle\fR commands.
Packit fcad23
(This should
Packit fcad23
be fixed in the future with an appropriate signal catch and wait()
Packit fcad23
combination).
Packit fcad23
.IP o
Packit fcad23
All directives listed with a value of "yes" actually accept a range
Packit fcad23
of boolean values.  These will accept any of \fI1\fR, \fIyes\fR or
Packit fcad23
\fItrue\fR to enable the corresponding behaviour, 
Packit fcad23
or any of \fI0\fR, \fIno\fR or \fIfalse\fR to disable it.
Packit fcad23
The default in each case is for the feature to be turned off, so these
Packit fcad23
directives are typically only used to enable the appropriate behaviour.
Packit fcad23
.SH FILES
Packit fcad23
SYSCONFDIR/snmp/snmptrapd.conf
Packit fcad23
.SH "SEE ALSO"
Packit fcad23
snmp_config(5), snmptrapd(8), syslog(8), traptoemail(1), variables(5), netsnmp_config_api(3).
Packit fcad23