1SNMP_CONFIG(5)                     Net-SNMP                     SNMP_CONFIG(5)
2
3
4

NAME

6       snmp_config - handling of Net-SNMP configuration files
7

DESCRIPTION

9       The  Net-SNMP package uses various configuration files to configure its
10       applications.  This manual page merely describes the overall nature  of
11       them, so that the other manual pages don't have to.
12

DIRECTORIES SEARCHED

14       First  off,  there  are numerous places that configuration files can be
15       found and read from.  By default, the applications look for  configura‐
16       tion  files  in  the  following  4  directories,  in  order: /etc/snmp,
17       /usr/share/snmp, /usr/lib(64)/snmp, and $HOME/.snmp.  In each of  these
18       directories,   it   looks   for   files  snmp.conf,  snmpd.conf  and/or
19       snmptrapd.conf, as well  as  snmp.local.conf,  snmpd.local.conf  and/or
20       snmptrapd.local.conf.  *.local.conf  are always read last. In this man‐
21       ner, there are 8 default places a configuration file can exist for  any
22       given configuration file type.
23
24       Additionally,  the  above default search path can be overridden by set‐
25       ting the environment variable SNMPCONFPATH to a colon-separated list of
26       directories  to search for.  The path for the persistent data should be
27       included when running applications that use persistent storage, such as
28       snmpd.
29
30       Applications  will read persistent configuration files in the following
31       order of preference:
32
33              file in SNMP_PERSISTENT_FILE environment variable
34
35              directories in SNMPCONFPATH environment variable
36
37              directory defined by persistentDir snmp.conf variable
38
39              directory in SNMP_PERSISTENT_DIR environment variable
40
41              default /var/lib/net-snmp directory
42
43       Finally, applications will write persistent configuration files in  the
44       following order of preference:
45
46              file in SNMP_PERSISTENT_FILE environment variable
47
48              directory defined by persistentDir snmp.conf variable
49
50              directory in SNMP_PERSISTENT_DIR environment variable
51
52              default /var/lib/net-snmp directory
53
54       Note:   When  using SNMP_PERSISTENT_FILE, the filename should match the
55       application name.  For example, /var/net-snmp/snmpd.conf.
56

CONFIGURATION FILE TYPES

58       Each application may use multiple configuration files, which will  con‐
59       figure various different aspects of the application.  For instance, the
60       SNMP agent (snmpd) knows how to understand configuration directives  in
61       both  the  snmpd.conf  and the snmp.conf files.  In fact, most applica‐
62       tions understand how to read  the  contents  of  the  snmp.conf  files.
63       Note, however, that configuration directives understood in one file may
64       not be understood in another file.  For further information,  read  the
65       associated  manual  page with each configuration file type.  Also, most
66       of the applications support a -H switch on the command line  that  will
67       list  the  configuration  files  it will look for and the directives in
68       each one that it understands.
69
70       The snmp.conf configuration file is intended to be a application  suite
71       wide  configuration  file  that supports directives that are useful for
72       controlling the fundamental nature of all  of  the  SNMP  applications,
73       such as how they all manipulate and parse the textual SNMP MIB files.
74

SWITCHING CONFIGURATION TYPES IN MID-FILE

76       It's  possible  to  switch  in mid-file the configuration type that the
77       parser is supposed to be reading.  Since  that  sentence  doesn't  make
78       much  sense,  lets  give you an example: say that you wanted to turn on
79       packet dumping output for the agent by default, but you didn't want  to
80       do  that for the rest of the applications (ie, snmpget, snmpwalk, ...).
81       Normally to enable packet dumping in the configuration file you'd  need
82       to put a line like:
83
84              dumpPacket true
85
86       into  the  snmp.conf  file.   But, this would turn it on for all of the
87       applications.  So, instead, you can put the same line in the snmpd.conf
88       file so that it only applies to the snmpd daemon.  However, you need to
89       tell the parser to expect this line.  You do this by putting a  special
90       type  specification token inside a [] set.  In other words, inside your
91       snmpd.conf file you could put the above snmp.conf directive by adding a
92       line like so:
93
94              [snmp] dumpPacket true
95
96       This  tells  the  parser to parse the above line as if it were inside a
97       snmp.conf file instead of an snmpd.conf file.  If you want to  parse  a
98       bunch  of  lines  rather  than  just  one then you can make the context
99       switch apply to the remainder of the file or  until  the  next  context
100       switch directive by putting the special token on a line by itself:
101
102              # make this file handle snmp.conf tokens:
103              [snmp]
104              dumpPacket true
105              logTimestamp true
106              # return to our original snmpd.conf tokens:
107              [snmpd]
108              rocommunity mypublic
109

COMMENTS

111       Any  lines  beginning with the character '#' in the configuration files
112       are treated as a comment and are not parsed.
113

INCLUDING OTHER CONFIGURATION FILES

115       It is possible to include other configuration files for processing dur‐
116       ing normal configuration file processing.:
117
118              # include site specific config
119              includeFile site.conf
120
121       This will search every directory in the configuration path for files
122       named site.conf, and will process those files before returning to the
123       processing of the original file. Note that if '.conf' is omitted,
124       it will be appended. That is, all configuration files must end
125       in '.conf'.
126
127              # include a all *.conf files in a directory
128              includeDir /etc/snmp/config.d
129
130       This will search specified directory for all files with '.conf'
131       suffix and process them as if they were included using includeFile
132       directive. The configuration files are not processed in any particular
133       order.
134
135       The specified directory must be absolute directory path.
136

API INTERFACE

138       Information  about  writing  C  code  that  makes use of this system in
139       either the agent's MIB modules or in applications can be found  in  the
140       read_config(3) manual page.
141

SEE ALSO

143       snmpconf(1), read_config(3), snmp.conf(5), snmpd.conf(5)
144
145
146
1474th Berkeley Distribution         5 May 2005                    SNMP_CONFIG(5)
Impressum