]>
Commit | Line | Data |
---|---|---|
f2121eaa AF |
1 | ############################################################################### |
2 | # | |
3 | # EXAMPLE.conf: | |
4 | # An example configuration file for configuring the net-snmp snmpd agent. | |
5 | # | |
6 | ############################################################################### | |
7 | # | |
8 | # This file is intended to only be an example. If, however, you want | |
9 | # to use it, it should be placed in /etc/snmp/snmpd.conf. | |
10 | # When the snmpd agent starts up, this is where it will look for it. | |
11 | # | |
12 | # All lines beginning with a '#' are comments and are intended for you | |
13 | # to read. All other lines are configuration commands for the agent. | |
14 | ||
15 | # | |
16 | # PLEASE: read the snmpd.conf(5) manual page as well! | |
17 | ||
18 | #agentaddress 161,tcp:161 | |
19 | ||
20 | ############################################################################### | |
21 | # System contact information | |
22 | # | |
23 | ||
24 | # It is also possible to set the sysContact and sysLocation system | |
25 | # variables through the snmpd.conf file: | |
26 | ||
27 | syslocation Unknown | |
28 | syscontact Root <root@localhost> | |
29 | ||
30 | # Example output of snmpwalk: | |
31 | # % snmpwalk -v 1 localhost public system | |
32 | # system.sysDescr.0 = "PLD Linux" | |
33 | # system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 | |
34 | # system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 | |
35 | # system.sysContact.0 = "Root <root@localhost>" | |
36 | # system.sysName.0 = "name" | |
37 | # system.sysLocation.0 = "Right here, right now." | |
38 | # system.sysServices.0 = 72 | |
39 | ||
40 | ############################################################################### | |
41 | # Access Control | |
42 | ############################################################################### | |
43 | ||
44 | # By far, the most common question I get about the agent is "why won't | |
45 | # it work?", when really it should be "how do I configure the agent to | |
46 | # allow me to access it?" | |
47 | # | |
48 | # By default, the agent responds to the "public" community for read | |
49 | # only access, if run out of the box without any configuration file in | |
50 | # place. The following examples show you other ways of configuring | |
51 | # the agent so that you can change the community names, and give | |
52 | # yourself write access as well. | |
53 | ||
54 | # The following lines change the access permissions of the agent so | |
55 | # that the COMMUNITY string provides read-only access to your entire | |
56 | # NETWORK (EG: 10.10.10.0/24), and read/write access to only the | |
57 | # localhost (127.0.0.1, not its real ipaddress). | |
58 | ||
59 | # For more information, read the FAQ as well as the snmpd.conf(5) | |
60 | # manual page. | |
61 | ||
62 | #### | |
63 | # First, map the community name (COMMUNITY) into a security name | |
64 | # (local and mynetwork, depending on where the request is coming | |
65 | # from): | |
66 | ||
67 | # sec.name source community | |
68 | com2sec local localhost public | |
69 | com2sec theworld default public | |
70 | ||
71 | #### | |
72 | # Second, map the security names into group names: | |
73 | ||
74 | # sec.model sec.name | |
75 | group MyRWGroup v2c local | |
76 | group MyROGroup v2c theworld | |
77 | ||
78 | #### | |
79 | # Third, create a view for us to let the groups have rights to: | |
80 | ||
81 | # incl/excl subtree mask | |
82 | view all included .1 80 | |
83 | ||
84 | #### | |
85 | # Finally, grant the 2 groups access to the 1 view with different | |
86 | # write permissions: | |
87 | ||
88 | # context sec.model sec.level prefix read write notif | |
89 | access MyROGroup "" any noauth exact all none none | |
90 | access MyRWGroup "" any noauth exact all all none | |
91 | ||
92 | # ----------------------------------------------------------------------------- | |
93 | ||
94 | ||
95 | ||
96 | ||
97 | # ----------------------------------------------------------------------------- | |
98 | ||
99 | ||
100 | ############################################################################### | |
101 | # Process checks. | |
102 | # | |
103 | # The following are examples of how to use the agent to check for | |
104 | # processes running on the host. The syntax looks something like: | |
105 | # | |
106 | # proc NAME [MAX=0] [MIN=0] | |
107 | # | |
108 | # NAME: the name of the process to check for. It must match | |
109 | # exactly (ie, http will not find httpd processes). | |
110 | # MAX: the maximum number allowed to be running. Defaults to 0. | |
111 | # MIN: the minimum number to be running. Defaults to 0. | |
112 | ||
113 | # | |
114 | # Examples: | |
115 | # | |
116 | ||
117 | # Make sure mountd is running | |
118 | # proc mountd | |
119 | ||
120 | # Make sure there are no more than 4 ntalkds running, but 0 is ok too. | |
121 | # proc ntalkd 4 | |
122 | ||
123 | # Make sure at least one sendmail, but less than or equal to 10 are running. | |
124 | # proc sendmail 10 1 | |
125 | ||
126 | # A snmpwalk of the process mib tree would look something like this: | |
127 | # | |
128 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.2 | |
129 | # enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 | |
130 | # enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 | |
131 | # enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 | |
132 | # enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" | |
133 | # enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" | |
134 | # enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" | |
135 | # enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 | |
136 | # enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 | |
137 | # enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 | |
138 | # enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 | |
139 | # enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 | |
140 | # enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 | |
141 | # enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 | |
142 | # enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 | |
143 | # enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 | |
144 | # enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 | |
145 | # enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 | |
146 | # enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 | |
147 | # enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." | |
148 | # enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" | |
149 | # enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" | |
150 | # enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 | |
151 | # enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 | |
152 | # enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 | |
153 | # | |
154 | # Note that the errorFlag for mountd is set to 1 because one is not | |
155 | # running (in this case an rpc.mountd is, but thats not good enough), | |
156 | # and the ErrMessage tells you what's wrong. The configuration | |
157 | # imposed in the snmpd.conf file is also shown. | |
158 | # | |
159 | # Special Case: When the min and max numbers are both 0, it assumes | |
160 | # you want a max of infinity and a min of 1. | |
161 | # | |
162 | ||
163 | ||
164 | # ----------------------------------------------------------------------------- | |
165 | ||
166 | ||
167 | ############################################################################### | |
168 | # Executables/scripts | |
169 | # | |
170 | ||
171 | # | |
172 | # You can also have programs run by the agent that return a single | |
173 | # line of output and an exit code. Here are two examples. | |
174 | # | |
175 | # exec NAME PROGRAM [ARGS ...] | |
176 | # | |
177 | # NAME: A generic name. | |
178 | # PROGRAM: The program to run. Include the path! | |
179 | # ARGS: optional arguments to be passed to the program | |
180 | ||
181 | # a simple hello world | |
30fd5608 | 182 | #exec echotest /bin/echo hello world |
f2121eaa AF |
183 | |
184 | # Run a shell script containing: | |
185 | # | |
186 | # #!/bin/sh | |
187 | # echo hello world | |
188 | # echo hi there | |
189 | # exit 35 | |
190 | # | |
191 | # Note: this has been specifically commented out to prevent | |
192 | # accidental security holes due to someone else on your system writing | |
193 | # a /tmp/shtest before you do. Uncomment to use it. | |
194 | # | |
195 | #exec shelltest /bin/sh /tmp/shtest | |
196 | ||
197 | # Then, | |
198 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.8 | |
199 | # enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 | |
200 | # enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 | |
201 | # enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" | |
202 | # enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" | |
203 | # enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" | |
204 | # enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" | |
205 | # enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 | |
206 | # enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 | |
207 | # enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." | |
208 | # enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." | |
209 | # enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 | |
210 | # enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 | |
211 | ||
212 | # Note that the second line of the /tmp/shtest shell script is cut | |
213 | # off. Also note that the exit status of 35 was returned. | |
214 | ||
215 | # ----------------------------------------------------------------------------- | |
216 | ||
217 | ||
218 | ############################################################################### | |
219 | # disk checks | |
220 | # | |
221 | ||
222 | # The agent can check the amount of available disk space, and make | |
223 | # sure it is above a set limit. | |
224 | ||
225 | # disk PATH [MIN=100000] | |
226 | # | |
227 | # PATH: mount path to the disk in question. | |
228 | # MIN: Disks with space below this value will have the Mib's errorFlag set. | |
229 | # Default value = 100000. | |
230 | ||
231 | # Check the / partition and make sure it contains at least 10 megs. | |
232 | ||
233 | disk / 10000 | |
234 | ||
235 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.9 | |
236 | # enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 | |
237 | # enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F | |
238 | # enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" | |
239 | # enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 | |
240 | # enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 | |
241 | # enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 | |
242 | # enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 | |
243 | # enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 | |
244 | # enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 | |
245 | # enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" | |
246 | ||
247 | # ----------------------------------------------------------------------------- | |
248 | ||
249 | ||
250 | ############################################################################### | |
251 | # load average checks | |
252 | # | |
253 | ||
254 | # load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] | |
255 | # | |
256 | # 1MAX: If the 1 minute load average is above this limit at query | |
257 | # time, the errorFlag will be set. | |
258 | # 5MAX: Similar, but for 5 min average. | |
259 | # 15MAX: Similar, but for 15 min average. | |
260 | ||
261 | # Check for loads: | |
262 | load 12 14 14 | |
263 | ||
264 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.10 | |
265 | # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 | |
266 | # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 | |
267 | # enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 | |
268 | # enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" | |
269 | # enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" | |
270 | # enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" | |
271 | # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 | |
272 | # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 | |
273 | # enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 | |
274 | # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" | |
275 | # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" | |
276 | # enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" | |
277 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 | |
278 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 | |
279 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 | |
280 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" | |
281 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" | |
282 | # enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" | |
283 | ||
284 | # ----------------------------------------------------------------------------- | |
285 | ||
286 | ||
287 | ############################################################################### | |
288 | # Extensible sections. | |
289 | # | |
290 | ||
291 | # This alleviates the multiple line output problem found in the | |
292 | # previous executable mib by placing each mib in its own mib table: | |
293 | ||
294 | # Run a shell script containing: | |
295 | # | |
296 | # #!/bin/sh | |
297 | # echo hello world | |
298 | # echo hi there | |
299 | # exit 35 | |
300 | # | |
301 | # Note: this has been specifically commented out to prevent | |
302 | # accidental security holes due to someone else on your system writing | |
303 | # a /tmp/shtest before you do. Uncomment to use it. | |
304 | # | |
305 | # exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest | |
306 | ||
307 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.50 | |
308 | # enterprises.ucdavis.50.1.1 = 1 | |
309 | # enterprises.ucdavis.50.2.1 = "shelltest" | |
310 | # enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" | |
311 | # enterprises.ucdavis.50.100.1 = 35 | |
312 | # enterprises.ucdavis.50.101.1 = "hello world." | |
313 | # enterprises.ucdavis.50.101.2 = "hi there." | |
314 | # enterprises.ucdavis.50.102.1 = 0 | |
315 | ||
316 | # Now the Output has grown to two lines, and we can see the 'hi | |
317 | # there.' output as the second line from our shell script. | |
318 | # | |
319 | # Note that you must alter the mib.txt file to be correct if you want | |
320 | # the .50.* outputs above to change to reasonable text descriptions. | |
321 | ||
322 | # Other ideas: | |
323 | # | |
324 | # exec .1.3.6.1.4.1.2021.51 ps /bin/ps | |
325 | # exec .1.3.6.1.4.1.2021.52 top /usr/bin/top | |
326 | # exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq | |
327 | ||
328 | # ----------------------------------------------------------------------------- | |
329 | ||
330 | ||
331 | ############################################################################### | |
332 | # Pass through control. | |
333 | # | |
334 | ||
335 | # Usage: | |
336 | # pass MIBOID EXEC-COMMAND | |
337 | # | |
338 | # This will pass total control of the mib underneath the MIBOID | |
339 | # portion of the mib to the EXEC-COMMAND. | |
340 | # | |
341 | # Note: You'll have to change the path of the passtest script to your | |
342 | # source directory or install it in the given location. | |
343 | # | |
344 | # Example: (see the script for details) | |
345 | # (commented out here since it requires that you place the | |
346 | # script in the right location. (its not installed by default)) | |
347 | ||
348 | # pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/passtest | |
349 | ||
350 | # % snmpwalk -v 1 localhost public .1.3.6.1.4.1.2021.255 | |
351 | # enterprises.ucdavis.255.1 = "life the universe and everything" | |
352 | # enterprises.ucdavis.255.2.1 = 42 | |
353 | # enterprises.ucdavis.255.2.2 = OID: 42.42.42 | |
354 | # enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 | |
355 | # enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 | |
356 | # enterprises.ucdavis.255.5 = 42 | |
357 | # enterprises.ucdavis.255.6 = Gauge: 42 | |
358 | # | |
359 | # % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 | |
360 | # enterprises.ucdavis.255.5 = 42 | |
361 | # | |
362 | # % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" | |
363 | # enterprises.ucdavis.255.1 = "New string" | |
364 | # | |
365 | ||
366 | # For specific usage information, see the man/snmpd.conf.5 manual page | |
367 | # as well as the local/passtest script used in the above example. |