Net-SNMP SNMP_CONFIG(5)
NAME
snmp_config - handling of Net-SNMP configuration files
DESCRIPTION
The Net-SNMP package uses various configuration files to
configure its applications. This manual page merely describes the overall nature of them, so that the other manual pages don't have to. DIRECTORIES SEARCHED First off, there are numerous places that configurationfiles can be found and read from. By default, the applica-
tions look for configuration files in the following 4 direc-
tories, in order: /usr/etc/snmp, /etc/net-snmp/snmp,
/usr/lib/snmp, and $HOME/.snmp. In each of these direc-
tories, it looks for files with the extension of both conf and local.conf (reading the second ones last). In this manner, there are 8 default places a configuration file can exist for any given configuration file type.Additionally, the above default search path can be overrid-
den by setting the environment variable SNMPCONFPATH to acolon-separated list of directories to search for. The path
for the persistent data should be included when running applications that use persistent storage, such as snmpd. Applications will read persistent configuration files in the following order of preference:file in SNMP_PERSISTENT_FILE environment variable
directories in SNMPCONFPATH environment variable directory defined by persistentDir snmp.conf variabledirectory in SNMP_PERSISTENT_DIR environment variable
default /var/net-snmp directory
Finally, applications will write persistent configuration files in the following order of preference:file in SNMP_PERSISTENT_FILE environment variable
directory defined by persistentDir snmp.conf variabledirectory in SNMP_PERSISTENT_DIR environment variable
default /var/net-snmp directory
Note: When using SNMP_PERSISTENT_FILE, the filename should
match the application name. For example, /var/net-
V5.4.1 Last change: 5 May 2005 1Net-SNMP SNMP_CONFIG(5)
snmp/snmpd.conf. CONFIGURATION FILE TYPES Each application may use multiple configuration files, which will configure various different aspects of the application. For instance, the SNMP agent (snmpd) knows how to understand configuration directives in both the snmpd.conf and the snmp.conf files. In fact, most applications understand how to read the contents of the snmp.conf files. Note, however, that configuration directives understood in one file may not be understood in another file. For further information, read the associated manual page with each configuration filetype. Also, most of the applications support a -H switch on
the command line that will list the configuration files itwill look for and the directives in each one that it under-
stands.The snmp.conf configuration file is intended to be a appli-
cation suite wide configuration file that supports direc-
tives that are useful for controlling the fundamental natureof all of the SNMP applications, such as how they all mani-
pulate and parse the textual SNMP MIB files.SWITCHING CONFIGURATION TYPES IN MID-FILE
It's possible to switch in mid-file the configuration type
that the parser is supposed to be reading. Since that sen-
tence doesn't make much sense, lets give you an example: say that you wanted to turn on packet dumping output for the agent by default, but you didn't want to do that for therest of the applications (ie, snmpget, snmpwalk, ...). Nor-
mally to enable packet dumping in the configuration file you'd need to put a line like: dumpPacket true into the snmp.conf file. But, this would turn it on for all of the applications. So, instead, you can put the same line in the snmpd.conf file so that it only applies to the snmpd daemon. However, you need to tell the parser to expect this line. You do this by putting a special type specification token inside a [] set. In other words, inside your snmpd.conf file you could put the above snmp.conf directive by adding a line like so: [snmp] dumpPacket true This tells the parser to parse the above line as if it were inside a snmp.conf file instead of an snmpd.conf file. If you want to parse a bunch of lines rather than just one then you can make the context switch apply to the remainder ofthe file or until the next context switch directive by put-
ting the special token on a line by itself: V5.4.1 Last change: 5 May 2005 2Net-SNMP SNMP_CONFIG(5)
# make this file handle snmp.conf tokens:
[snmp] dumpPacket true logTimestamp true# return to our original snmpd.conf tokens:
[snmpd] rocommunity mypublic COMMENTSAny lines beginning with the character '#' in the configura-
tion files are treated as a comment and are not parsed. API INTERFACEInformation about writing C code that makes use of this sys-
tem in either the agent's MIB modules or in applications canbe found in the read_config(3) manual page.
SEE ALSO
snmpconf(1), read_config(3), snmp.conf(5), snmpd.conf(5)
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:_______________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|____________________|__________________________________|_
| Availability | system/management/snmp/net-snmp|
|____________________|__________________________________|_
| Interface Stability| Volatile ||____________________|_________________________________|
NOTESSource for net-snmp is available on http://opensolaris.org.
V5.4.1 Last change: 5 May 2005 3