Blame man/snmp_config.5.def

Packit Service b38f0b
.TH SNMP_CONFIG 5 "08 Mar 2010" VVERSIONINFO "Net-SNMP"
Packit Service b38f0b
.SH NAME
Packit Service b38f0b
snmp_config - handling of Net-SNMP configuration files
Packit Service b38f0b
.SH DESCRIPTION
Packit Service b38f0b
The Net-SNMP package uses various configuration files to configure its 
Packit Service b38f0b
applications.  This manual page merely describes the overall nature of 
Packit Service b38f0b
them, so that the other manual pages don't have to.
Packit Service b38f0b
.SH "DIRECTORIES SEARCHED"
Packit Service b38f0b
First off, there are numerous places that configuration files can be
Packit Service b38f0b
found and read from.  By default, the applications look for
Packit Service b38f0b
configuration files in the following 4 directories, in order:
Packit Service b38f0b
SYSCONFDIR/snmp,
Packit Service fd9b19
DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp.  In each of these
Packit Service b38f0b
directories, it looks for files snmp.conf, snmpd.conf and/or
Packit Service b38f0b
snmptrapd.conf, as well as snmp.local.conf, snmpd.local.conf
Packit Service b38f0b
and/or snmptrapd.local.conf. *.local.conf are always
Packit Service b38f0b
read last. In this manner, there are
Packit Service b38f0b
8 default places a configuration file can exist for any given
Packit Service b38f0b
configuration file type.
Packit Service b38f0b
.PP
Packit Service b38f0b
Additionally, the above default search path can be overridden by
Packit Service b38f0b
setting the environment variable SNMPCONFPATH to a colon-separated
Packit Service b38f0b
list of directories to search for.  The path for the persistent
Packit Service b38f0b
data should be included when running applications that use
Packit Service b38f0b
persistent storage, such as snmpd.
Packit Service b38f0b
.PP
Packit Service b38f0b
Applications will read persistent configuration files 
Packit Service b38f0b
in the following order of preference:
Packit Service b38f0b
.RS
Packit Service b38f0b
.PP
Packit Service b38f0b
file in 
Packit Service b38f0b
.B SNMP_PERSISTENT_FILE
Packit Service b38f0b
environment variable
Packit Service b38f0b
.br
Packit Service b38f0b
directories in 
Packit Service b38f0b
.B SNMPCONFPATH
Packit Service b38f0b
environment variable
Packit Service b38f0b
.br
Packit Service b38f0b
directory defined by 
Packit Service b38f0b
.B
Packit Service b38f0b
persistentDir 
Packit Service b38f0b
snmp.conf variable
Packit Service b38f0b
.br
Packit Service b38f0b
directory in 
Packit Service b38f0b
.B
Packit Service b38f0b
SNMP_PERSISTENT_DIR 
Packit Service b38f0b
environment variable
Packit Service b38f0b
.br
Packit Service b38f0b
default 
Packit Service b38f0b
.B
Packit Service b38f0b
PERSISTENT_DIRECTORY 
Packit Service b38f0b
directory
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
Finally, applications will write persistent configuration files 
Packit Service b38f0b
in the following order of preference:
Packit Service b38f0b
.RS
Packit Service b38f0b
.PP
Packit Service b38f0b
file in 
Packit Service b38f0b
.B SNMP_PERSISTENT_FILE
Packit Service b38f0b
environment variable
Packit Service b38f0b
.br
Packit Service b38f0b
directory defined by 
Packit Service b38f0b
.B
Packit Service b38f0b
persistentDir 
Packit Service b38f0b
snmp.conf variable
Packit Service b38f0b
.br
Packit Service b38f0b
directory in 
Packit Service b38f0b
.B
Packit Service b38f0b
SNMP_PERSISTENT_DIR 
Packit Service b38f0b
environment variable
Packit Service b38f0b
.br
Packit Service b38f0b
default 
Packit Service b38f0b
.B
Packit Service b38f0b
PERSISTENT_DIRECTORY 
Packit Service b38f0b
directory
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
Note:  When using SNMP_PERSISTENT_FILE, the filename should match the 
Packit Service b38f0b
application name.  For example, /var/net-snmp/snmpd.conf.
Packit Service b38f0b
.SH "CONFIGURATION FILE TYPES"
Packit Service b38f0b
Each application may use multiple configuration files, which will
Packit Service b38f0b
configure various different aspects of the application.  For instance, 
Packit Service b38f0b
the SNMP agent
Packit Service b38f0b
.RB ( snmpd )
Packit Service b38f0b
knows how to understand configuration
Packit Service b38f0b
directives in both the snmpd.conf and the snmp.conf files.  In fact,
Packit Service b38f0b
most applications understand how to read the contents of the snmp.conf 
Packit Service b38f0b
files.  Note, however, that configuration directives understood in one 
Packit Service b38f0b
file may not be understood in another file.  For further information,
Packit Service b38f0b
read the associated manual page with each configuration file type.
Packit Service b38f0b
Also, most of the applications support a 
Packit Service b38f0b
.B -H
Packit Service b38f0b
switch on the command line that will list the configuration files it
Packit Service b38f0b
will look for and the directives in each one that it understands.
Packit Service b38f0b
.PP
Packit Service b38f0b
The snmp.conf configuration file is intended to be a application suite 
Packit Service b38f0b
wide configuration file that supports directives that are useful for
Packit Service b38f0b
controlling the fundamental nature of all of the SNMP applications,
Packit Service b38f0b
such as how they all manipulate and parse the textual SNMP MIB files.
Packit Service b38f0b
.SH "SWITCHING CONFIGURATION TYPES IN MID-FILE"
Packit Service b38f0b
It's possible to switch in mid-file the configuration type that the
Packit Service b38f0b
parser is supposed to be reading.  Since that sentence doesn't make
Packit Service b38f0b
much sense, lets give you an example: say that you wanted to turn on
Packit Service b38f0b
packet dumping output for the agent by default, but you didn't want to
Packit Service b38f0b
do that for the rest of the applications (ie, snmpget, snmpwalk, ...).
Packit Service b38f0b
Normally to enable packet dumping in the configuration file
Packit Service b38f0b
you'd need to put a line like:
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
dumpPacket true
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
into the snmp.conf file.  But, this would turn it on for all of the
Packit Service b38f0b
applications.  So, instead, you can put the same line in the
Packit Service b38f0b
snmpd.conf file so that it only applies to the snmpd daemon.  However,
Packit Service b38f0b
you need to tell the parser to expect this line.  You do this by
Packit Service b38f0b
putting a special type specification token inside a [] set.  In other
Packit Service b38f0b
words, inside your snmpd.conf file you could put the above snmp.conf
Packit Service b38f0b
directive by adding a line like so:
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
[snmp] dumpPacket true
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
This tells the parser to parse the above line as if it were inside a
Packit Service b38f0b
snmp.conf file instead of an snmpd.conf file.  If you want to parse a
Packit Service b38f0b
bunch of lines rather than just one then you can make the context
Packit Service b38f0b
switch apply to the remainder of the file or until the next context
Packit Service b38f0b
switch directive by putting the special token on a line by itself:
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
.nf
Packit Service b38f0b
# make this file handle snmp.conf tokens:
Packit Service b38f0b
[snmp]
Packit Service b38f0b
dumpPacket true
Packit Service b38f0b
logTimestamp true
Packit Service b38f0b
# return to our original snmpd.conf tokens:
Packit Service b38f0b
[snmpd]
Packit Service b38f0b
rocommunity mypublic
Packit Service b38f0b
.fi
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
The same approach can be used to set configuration directives for a
Packit Service b38f0b
particular client application (or group of applications).  For example,
Packit Service b38f0b
any program that uses the 'snmp_parse_args()' call to handle command-line
Packit Service b38f0b
arguments (including the standard command-line tools shipped as part of the
Packit Service b38f0b
Net-SNMP distributions) will automatically read the config file 'snmpapp.conf'.
Packit Service b38f0b
To set library-level settings for these applications (but not other
Packit Service b38f0b
more-specific tools), use configuration such as the following:
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
[snmp] defCommunity myCommunity
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
for a single directive, or
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
.nf
Packit Service b38f0b
# make this file handle snmp.conf tokens:
Packit Service b38f0b
[snmp]
Packit Service b38f0b
defCommunity myCommunity
Packit Service b38f0b
defVersion   2c
Packit Service b38f0b
# return to our original snmpapp.conf tokens:
Packit Service b38f0b
[snmpapp]
Packit Service b38f0b
.fi
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
for multiple settings.
Packit Service b38f0b
Similarly for any other application token (as passed to init_snmp()).
Packit Service b38f0b
.SH COMMENTS
Packit Service b38f0b
.PP
Packit Service b38f0b
Any lines beginning with the character '#' in the configuration files
Packit Service b38f0b
are treated as a comment and are not parsed.
Packit Service b38f0b
.SH "INCLUDING OTHER CONFIGURATION FILES"
Packit Service b38f0b
It is possible to include other configuration files for processing
Packit Service b38f0b
during normal configuration file processing.:
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
.nf
Packit Service b38f0b
# include site specific config
Packit Service b38f0b
includeFile site.conf
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
This will load the specified configuration file. The
Packit Service b38f0b
path to file must be either absolute, starting with '/',
Packit Service b38f0b
or relative. The relative path is then relative to the directory
Packit Service b38f0b
where the parent file with 'includeFile' directive resides.
Packit Service b38f0b
.PP
Packit Service b38f0b
The included file name does not need to have '.conf' suffix.
Packit Service b38f0b
.PP
Packit Service b38f0b
.RS
Packit Service b38f0b
.nf
Packit Service b38f0b
# include a all *.conf files in a directory
Packit Service b38f0b
includeDir /etc/snmp/config.d
Packit Service b38f0b
.RE
Packit Service b38f0b
.PP
Packit Service b38f0b
This will search specified directory for all files with '.conf'
Packit Service b38f0b
suffix and process them as if they were included using includeFile
Packit Service b38f0b
directive. The configuration files are not processed in any particular
Packit Service b38f0b
order.
Packit Service b38f0b
.PP
Packit Service b38f0b
The specified directory must be absolute directory path.
Packit Service b38f0b
.SH "API INTERFACE"
Packit Service b38f0b
.PP
Packit Service b38f0b
Information about writing C code that makes use of this system in
Packit Service b38f0b
either the agent's MIB modules or in applications can be found in the
Packit Service b38f0b
.I netsnmp_config_api(3)
Packit Service b38f0b
manual page.
Packit Service b38f0b
.SH "SEE ALSO"
Packit Service b38f0b
snmpconf(1),
Packit Service b38f0b
netsnmp_config_api(3),
Packit Service b38f0b
snmp.conf(5),
Packit Service b38f0b
snmpd.conf(5)
Packit Service b38f0b
.\" Local Variables:
Packit Service b38f0b
.\"  mode: nroff
Packit Service b38f0b
.\" End: