summaryrefslogtreecommitdiff
path: root/man/snmp_config.5.def
blob: 446fc113f5830e25f92f2f47541ff74ffdde6124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
.TH SNMP_CONFIG 5 "5 May 2005" VVERSIONINFO "Net-SNMP"
.UC 4
.SH NAME
snmp_config - handling of Net-SNMP configuration files
.SH 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.
.SH "DIRECTORIES SEARCHED"
First off, there are numerous places that configuration files can be
found and read from.  By default, the applications look for
configuration files in the following 4 directories, in order:
SYSCONFDIR/snmp,
DATADIR/snmp, LIBDIR/snmp, and $HOME/.snmp.  In each of these
directories, it looks for files with the extension of both
.IR 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.
.PP
Additionally, the above default search path can be overridden by
setting the environment variable SNMPCONFPATH to a colon-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.
.PP
Applications will read persistent configuration files 
in the following order of preference:
.RS
.PP
file in 
.B SNMP_PERSISTENT_FILE
environment variable
.PP
directories in 
.B SNMPCONFPATH
environment variable
.PP
directory defined by 
.B
persistentDir 
snmp.conf variable
.PP
directory in 
.B
SNMP_PERSISTENT_DIR 
environment variable
.PP
default 
.B
PERSISTENT_DIRECTORY 
directory
.RE
.PP
Finally, applications will write persistent configuration files 
in the following order of preference:
.RS
.PP
file in 
.B SNMP_PERSISTENT_FILE
environment variable
.PP
directory defined by 
.B
persistentDir 
snmp.conf variable
.PP
directory in 
.B
SNMP_PERSISTENT_DIR 
environment variable
.PP
default 
.B
PERSISTENT_DIRECTORY 
directory
.RE
.PP
Note:  When using SNMP_PERSISTENT_FILE, the filename should match the 
application name.  For example, /var/net-snmp/snmpd.conf.
.SH "CONFIGURATION FILE TYPES"
Each application may use multiple configuration files, which will
configure various different aspects of the application.  For instance, 
the SNMP agent
.RB ( 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 file type.
Also, most of the applications support a 
.B -H
switch on the command line that will list the configuration files it
will look for and the directives in each one that it understands.
.PP
The snmp.conf configuration file is intended to be a application suite 
wide configuration file that supports directives that are useful for
controlling the fundamental nature of all of the SNMP applications,
such as how they all manipulate and parse the textual SNMP MIB files.
.SH "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 sentence 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 the rest of the applications (ie, snmpget, snmpwalk, ...).
Normally to enable packet dumping in the configuration file
you'd need to put a line like:
.PP
.RS
dumpPacket true
.RE
.PP
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:
.PP
.RS
[snmp] dumpPacket true
.RE
.PP
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 of the file or until the next context
switch directive by putting the special token on a line by itself:
.PP
.RS
.nf
# make this file handle snmp.conf tokens:
[snmp]
dumpPacket true
logTimestamp true
# return to our original snmpd.conf tokens:
[snmpd]
rocommunity mypublic
.RE
.SH COMMENTS
.PP
Any lines beginning with the character '#' in the configuration files
are treated as a comment and are not parsed.
.SH "API INTERFACE"
.PP
Information about writing C code that makes use of this system in
either the agent's MIB modules or in applications can be found in the
.I read_config(3)
manual page.
.SH "SEE ALSO"
snmpconf(1),
read_config(3),
snmp.conf(5),
snmpd.conf(5)
.\" Local Variables:
.\"  mode: nroff
.\" End: