~ubuntu-branches/ubuntu/trusty/net-snmp/trusty

« back to all changes in this revision

Viewing changes to man/snmpd.examples.5.def

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-05-10 22:20:23 UTC
  • mto: (1.4.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20070510222023-3fr07xb9i17xvq32
Tags: upstream-5.3.1
ImportĀ upstreamĀ versionĀ 5.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH SNMPD.EXAMPLES 5 "05 Dec 2005" VVERSIONINFO "Net-SNMP"
 
2
.UC 4
 
3
.SH NAME
 
4
snmpd.examples - example configuration for the Net-SNMP agent
 
5
.SH DESCRIPTION
 
6
The
 
7
.I snmpd.conf(5)
 
8
man page defines the syntax and behaviour of the various
 
9
configuration directives that can be used to control the
 
10
operation of the Net-SNMP agent, and the management information
 
11
it provides.
 
12
.PP
 
13
This companion man page illustrates these directives, showing
 
14
some practical examples of how they might be used.
 
15
.SH AGENT BEHAVIOUR
 
16
.SS "Listening addresses"
 
17
The default agent behaviour (listing on the standard SNMP UDP port on
 
18
all interfaces) is equivalent to the directive:
 
19
.RS
 
20
agentaddress udp:161
 
21
.RE
 
22
or simply
 
23
.RS
 
24
agentaddress 161
 
25
.RE
 
26
The agent can be configured to \fIonly\fR accept requests sent to the
 
27
local loopback interface (again listening on the SNMP UDP port), using:
 
28
.RS
 
29
agentaddress localhost:161     \fI# (udp implicit)\fR
 
30
.RE
 
31
or
 
32
.RS
 
33
agentaddress 127.0.0.1     \fI# (udp and standard port implicit)\fR
 
34
.RE
 
35
It can be configured to accept both UDP and TCP requests (over both IPv4
 
36
and IPv6), using:
 
37
.RS
 
38
agentaddress udp:161,tcp:161,udp6:161,tcp6:161
 
39
.RE
 
40
.\"
 
41
.\" Can the agent handle the same port for both IPv4 & IPv6
 
42
.\"
 
43
Other combinations are also valid.
 
44
.SS "Run-time privileges"
 
45
The agent can be configured to relinquish any privileged access once it
 
46
has opened the initial listening ports.  Given a suitable "snmp" group
 
47
(defined in \fI/etc/group\fR), this could be done using the directives:
 
48
.RS
 
49
.nf
 
50
agentuser  nobody
 
51
agentgroup snmp
 
52
.fi
 
53
.RE
 
54
A similar effect could be achieved using numeric UID and/or GID values:
 
55
.RS
 
56
.nf
 
57
agentuser  #10
 
58
agentgroup #10
 
59
.fi
 
60
.RE
 
61
.\"
 
62
.\" What effect will/may this have on the information returned.
 
63
.\"   ??? Mention this in the main man page.
 
64
.\"
 
65
.SS SNMPv3 Configuration
 
66
Rather than being generated pseudo-randomly,
 
67
the engine ID for the agent could be calculated based on the MAC address
 
68
of the second network interface (\fIeth1\fR), using the directives:
 
69
.RS
 
70
engineIDType 3
 
71
engineIDNic  eth1
 
72
.RE
 
73
or it could be calculated from the (first) IP address, using:
 
74
.RS
 
75
engineIDType 1
 
76
.RE
 
77
or it could be specified explicitly, using:
 
78
.RS
 
79
engineID "XXX - WHAT FORMAT"
 
80
.RE
 
81
.\"
 
82
.\" Does engineID override the other directives, or what?
 
83
.\"
 
84
.SH ACCESS CONTROL
 
85
.SS SNMPv3 Users
 
86
The following directives will create three users, all using exactly
 
87
the same authentication and encryption settings:
 
88
.RS
 
89
.nf
 
90
createUser me     MD5 "single pass phrase"
 
91
createUser myself MD5 "single pass phrase" DES
 
92
createUser andI   MD5 "single pass phrase" DES "single pass phrase"
 
93
.fi
 
94
.RE
 
95
Note that this defines three \fIdistinct\fR users, who could be granted
 
96
different levels of access.  Changing the passphrase for any one of
 
97
these would not affect the other two.
 
98
.PP
 
99
Separate pass phrases can be specified for authentication and
 
100
encryption:
 
101
.RS
 
102
createUser onering SHA "to rule them all" AES "to bind them"
 
103
.RE
 
104
Remember that these \fIcreateUser\fR directives should be defined in the
 
105
PERSISTENT_DIRECTORY/snmpd.conf file, rather than the usual location.
 
106
.RE
 
107
.\"
 
108
.\"  ??? Illustrate "-e", "-l" and "-m" forms ??
 
109
.\"
 
110
.SS Traditional Access Control
 
111
The SNMPv3 users defined above can be granted access to the full
 
112
MIB tree using the directives:
 
113
.RS
 
114
.nf
 
115
rouser me
 
116
rwuser onering
 
117
.fi
 
118
.RE
 
119
Or selective access to individual subtrees using:
 
120
.RS
 
121
.nf
 
122
rouser myself   .1.3.6.1.2
 
123
rwuser andI     system
 
124
.fi
 
125
.RE
 
126
.PP
 
127
Note that a combination repeating the same user, such as:
 
128
.RS
 
129
.nf
 
130
rouser onering
 
131
rwuser onering
 
132
.fi
 
133
.RE
 
134
should \fBnot\fR be used. This would configure the user \fIonering\fR
 
135
with read-only access (and ignore the \fIrwuser\fR entry altogether).
 
136
The same holds for the community-based directives.
 
137
.PP
 
138
The directives:
 
139
.RS
 
140
.nf
 
141
rocommunity public
 
142
rwcommunity private
 
143
.fi
 
144
.RE
 
145
would define the commonly-expected read and write community strings
 
146
for SNMPv1 and SNMPv2c requests.  This behaviour is \fBnot\fR
 
147
configured by default, and would need to be set up explicitly.
 
148
.RS
 
149
.IP Note:
 
150
It would also be a very good idea to change \fIprivate\fR to something
 
151
a little less predictable!
 
152
.RE
 
153
.PP
 
154
A slightly less vulnerable configuration might restrict what information
 
155
could be retrieved:
 
156
.RS
 
157
rocommunity public   default system
 
158
.RE
 
159
or the management systems that settings could be manipulated from:
 
160
.RS
 
161
rwcommunity private  10.10.10.0/24
 
162
.RE
 
163
or a combination of the two.
 
164
.SS VACM Configuration
 
165
This last pair of settings are equivalent to the full VACM definitions:
 
166
.RS
 
167
.nf
 
168
\fI#         sec.name  source        community\fR
 
169
com2sec   public    default       public
 
170
com2sec   mynet     10.10.10.0/24 private
 
171
com2sec6  mynet     fec0::/64     private
 
172
 
 
173
\fI#                  sec.model  sec.name\fR
 
174
group  worldGroup  v1         public
 
175
group  worldGroup  v2c        public
 
176
group  myGroup     v1         mynet
 
177
group  myGroup     v2c        mynet
 
178
 
 
179
\fI#              incl/excl   subtree     [mask]\fR
 
180
view   all     included    .1
 
181
view   sysView included    system
 
182
 
 
183
\fI#              context model level   prefix  read    write  notify (unused)\fR
 
184
access  worldGroup  ""  any  noauth  exact   system  none   none
 
185
access  myGroup     ""  any  noauth  exact   all     all    none
 
186
.fi
 
187
.RE
 
188
.PP
 
189
There are several points to note in this example:
 
190
.PP
 
191
The \fIgroup\fR directives must be repeated for 
 
192
both SNMPv1 and SNMPv2c requests.
 
193
.PP
 
194
The \fIcom2sec\fR security name is distinct from the community
 
195
string that is mapped to it. They can be the same ("public")
 
196
or different ("mynet"/"private") - but what appears in the
 
197
\fIgroup\fR directive is the security name, regardless of
 
198
the original community string.
 
199
.PP
 
200
Both of the \fIview\fR directives are defining simple OID
 
201
subtrees, so neither of these require an explicit mask.
 
202
The same holds for the "combined subtree2 view defined below.
 
203
In fact, a mask field is only needed when defining row slices
 
204
across a table (or similar views), and can almost always be omitted.
 
205
.PP
 
206
In general, it is advisible not to mix traditional and VACM-based
 
207
access configuration settings, as these can sometimes interfere
 
208
with each other in unexpected ways.  Choose a particular style
 
209
of access configuration, and stick to it.
 
210
.\"
 
211
.\" Mention/use hardwired views '_all_' and '_none_'
 
212
.\"
 
213
.\" Illustrate other, more flexible configurations
 
214
.\"   including SNMPv3 access.
 
215
.\"
 
216
.SS Typed-View Configuration
 
217
A similar configuration could also be configured as follows:
 
218
.RS
 
219
.nf
 
220
view   sys2View included    system
 
221
view   sys2View included    .1.3.6.1.2.1.25.1
 
222
 
 
223
authcommunity read       public  default      -v sys2View
 
224
authcommunity read,write private 10.10.10.0/8
 
225
.fi
 
226
.RE
 
227
.PP
 
228
This mechanism allows multi-subtree (or other non-simple) views to
 
229
be used with the one-line \fIrocommunity\fR style of configuration.
 
230
.PP
 
231
It would also support configuring "write-only" access, should this
 
232
be required.
 
233
.\"
 
234
.\" Expand this example
 
235
.\"
 
236
.SH SYSTEM INFORMATION
 
237
.SS System Group
 
238
The full contents of the 'system' group (with the exception of \fCsysUpTime\fR)
 
239
can be explicitly configured using:
 
240
.RS
 
241
.nf
 
242
\fI# Override 'uname -a' and hardcoded system OID - inherently read-only values\fR
 
243
sysDescr     Universal Turing Machine mk I
 
244
sysObjectID  .1.3.6.1.4.1.8072.3.2.1066
 
245
 
 
246
\fI# Override default values from 'configure' - makes these objects read-only\fR
 
247
sysContact   Alan.Turing@pre-cs.man.ac.uk
 
248
sysName      tortoise.turing.com
 
249
sysLocation  An idea in the mind of AT
 
250
 
 
251
\fI# Standard end-host behaviour\fR
 
252
sysServices  72
 
253
.fi
 
254
.RE
 
255
.SS Host Resources Group
 
256
The list of devices probed for potential inclusion in the
 
257
\fChrDiskStorageTable\fR (and \fChrDeviceTable\fR) can be amended using
 
258
any of the following directives:
 
259
.RS
 
260
ignoredisk /dev/rdsk/c0t2d0
 
261
.RE
 
262
which prevents the device \fI/dev/rdsk/c0t2d0\fR from being scanned,
 
263
.RS
 
264
.nf
 
265
ignoredisk /dev/rdsk/c0t[!6]d0
 
266
ignoredisk /dev/rdsk/c0t[0-57-9a-f]d0
 
267
.fi
 
268
.RE
 
269
either of which prevents all devices \fI/dev/rdsk/c0t\fRX\fId0\fR
 
270
(except .../\fIc0t6d0\fR) from being scanned,
 
271
.RS
 
272
ignoredisk /dev/rdsk/c1*
 
273
.RE
 
274
which prevents all devices whose device names start with \fI/dev/rdsk/c1\fR
 
275
from being scanned, or
 
276
.RS
 
277
ignoredisk /dev/rdsk/c?t0d0
 
278
.RE
 
279
which prevents all devices \fI/dev/rdsk/c\fRX\fIt0d0\fR
 
280
(where 'X' is any single character) from being scanned.
 
281
.SS Process Monitoring 
 
282
The list of services running on a system can be monitored
 
283
(and provision made for correcting any problems), using:
 
284
.RS
 
285
.nf
 
286
\fI# At least one web server process must be running at all times\fR
 
287
proc    httpd
 
288
procfix httpd  /etc/rc.d/init.d/httpd restart
 
289
 
 
290
\fI# There should never be more than 10 mail processes running
 
291
#    (more implies a probable mail storm, so shut down the mail system)\fR
 
292
proc    sendmail   10
 
293
procfix sendmail  /etc/rc.d/init.d/sendmail stop
 
294
 
 
295
\fI# There should be a single network management agent running
 
296
#   ("There can be only one")\fR
 
297
proc    snmpd    1  1
 
298
.fi
 
299
.RE
 
300
Also see the "DisMan Event MIB" section later on.
 
301
.SS Disk Usage Monitoring
 
302
The state of disk storage can be monitored using:
 
303
.RS
 
304
.nf
 
305
includeAllDisks 10%
 
306
disk /var 20%
 
307
disk /usr  3%
 
308
\fI#  Keep 100 Mb free for crash dumps\fR
 
309
disk /mnt/crash  100000
 
310
.fi
 
311
.RE
 
312
.SS System Load Monitoring
 
313
A simple check for an overloaded system might be:
 
314
.RS
 
315
load 10
 
316
.RE
 
317
A more refined check (to allow brief periods of heavy use,
 
318
but recognise sustained medium-heavy load) might be:
 
319
.RS
 
320
load 30 10 5
 
321
.RE
 
322
.SS Log File Monitoring
 
323
.I TODO
 
324
.RS
 
325
file FILE [MAXSIZE]
 
326
.RE
 
327
.RS
 
328
logmatch NAME PATH CYCLETIME REGEX
 
329
.RE
 
330
.SH "ACTIVE MONITORING"
 
331
.SS "Notification Handling"
 
332
Configuring the agent to report invalid access attempts might be done by:
 
333
.RS
 
334
.nf
 
335
authtrapenable 1
 
336
trapcommunity  public
 
337
trap2sink      localhost
 
338
.fi
 
339
.RE
 
340
Alternatively, the second and third directives could be combined
 
341
(and an acknowledgement requested) using:
 
342
.RS
 
343
informsink     localhost  public
 
344
.RE
 
345
A configuration with repeated sink destinations, such as:
 
346
.RS
 
347
.nf
 
348
trapsink       localhost
 
349
trap2sink      localhost
 
350
informsink     localhost
 
351
.fi
 
352
.RE
 
353
should \fBNOT\fR be used, as this will cause multiple copies
 
354
of each trap to be sent to the same trap receiver.
 
355
.PP
 
356
.I "TODO - discuss SNMPv3 traps"
 
357
.RS
 
358
trapsess  \fIsnmpv3 options\fR  localhost:162
 
359
.RE
 
360
.PP
 
361
.I "TODO - mention trapd access configuration"
 
362
 
 
363
.SS "DisMan Event MIB"
 
364
The simplest configuration for active self-monitoring of
 
365
the agent, by the agent, for the agent, is probably:
 
366
.RS
 
367
.nf
 
368
\fI# Set up the credentials to retrieve monitored values\fR
 
369
createUser    _internal MD5 "the first sign of madness"
 
370
iquerySecName _internal
 
371
rouser        _internal
 
372
 
 
373
\fI# Active the standard monitoring entries\fR
 
374
defaultMonitors         yes
 
375
linkUpDownNotifications yes
 
376
 
 
377
\fI# If there's a problem, then tell someone!\fR
 
378
trap2sink localhost
 
379
.fi
 
380
.RE
 
381
.PP
 
382
The first block sets up a suitable user for retrieving the
 
383
information to by monitored, while the following pair of
 
384
directives activates various built-in monitoring entries.
 
385
.PP
 
386
Note that the DisMan directives are not themselves sufficient to
 
387
actively report problems - there also needs to be a suitable
 
388
destination configured to actually send the resulting notifications to.
 
389
.PP
 
390
A more detailed monitor example is given by:
 
391
.RS
 
392
monitor -u me -o hrSWRunName "high process memory" hrSWRunPerfMem > 10000
 
393
.RE
 
394
.PP
 
395
This defines an explicit boolean monitor entry, looking for any process
 
396
using more than 10Mb of active memory.  Such processes will be reported
 
397
using the (standard) DisMan trap \fCmteTriggerFired\fR,
 
398
but adding an extra (wildcarded) varbind \fChrSWRunName\fR.
 
399
.PP
 
400
This entry also specifies an explicit user (\fIme\fR, as defined
 
401
earlier) for retrieving the monitored values, and building the trap.
 
402
.PP
 
403
Objects that could potentially fluctuate around the specified level
 
404
are better monitored using a threshold monitor entry: 
 
405
.RS
 
406
monitor -D -r 10 "network traffic" ifInOctets 1000000 5000000
 
407
.RE
 
408
.PP
 
409
This will send a \fCmteTriggerRising\fR trap whenever the incoming
 
410
traffic rises above (roughly) 500 kB/s on any network interface,
 
411
and a corresponding \fCmteTriggerFalling\fR trap when it falls below
 
412
100 kB/s again.
 
413
.PP
 
414
Note that this monitors the deltas between successive samples (\fI-D\fR)
 
415
rather than the actual sample values themselves.  The same effect
 
416
could be obtained using:
 
417
.RS
 
418
monitor -r 10 "network traffic" ifInOctets - - 1000000 5000000
 
419
.RE
 
420
.PP
 
421
The \fIlinkUpDownNotifications\fR directive above is broadly
 
422
equivalent to:
 
423
.RS
 
424
.nf
 
425
notificationEvent  linkUpTrap    linkUp   ifIndex ifAdminStatus ifOperStatus
 
426
notificationEvent  linkDownTrap  linkDown ifIndex ifAdminStatus ifOperStatus
 
427
 
 
428
monitor  -r 60 -e linkUpTrap   "Generate linkUp"   ifOperStatus != 2
 
429
monitor  -r 60 -e linkDownTrap "Generate linkDown" ifOperStatus == 2
 
430
.fi
 
431
.RE
 
432
.PP
 
433
This defines the traps to be sent (using \fInotificationEvent\fR),
 
434
and explicitly references the relevant notification in the corresponding
 
435
monitor entry (rather than using the default DisMan traps).
 
436
.PP
 
437
The \fIdefaultMonitors\fR directive above is equivalent to a series
 
438
of (boolean) monitor entries:
 
439
.RS
 
440
.nf
 
441
monitor -o prNames      -o prErrMessage  "procTable" prErrorFlag   != 0
 
442
monitor -o memErrorName -o memSwapErrorMsg "memory"  memSwapError  != 0
 
443
monitor -o extNames     -o extOutput     "extTable"  extResult     != 0
 
444
monitor -o dskPath      -o dskErrorMsg   "dskTable"  dskErrorFlag  != 0
 
445
monitor -o laNames      -o laErrMessage  "laTable"   laErrorFlag   != 0
 
446
monitor -o fileName     -o fileErrorMsg  "fileTable" fileErrorFlag != 0
 
447
.fi
 
448
.RE
 
449
and will send a trap whenever any of these entries indicate a problem.
 
450
.PP
 
451
An alternative approach would be to automatically invoke the corresponding
 
452
"fix" action:
 
453
.RS
 
454
.nf
 
455
setEvent   prFixIt  prErrFix = 1
 
456
monitor -e prFixIt "procTable" prErrorFlag   != 0
 
457
.fi
 
458
.RE
 
459
(and similarly for any of the other \fIdefaultMonitor\fR entries).
 
460
.SS "DisMan Schedule MIB"
 
461
The agent could be configured to reload its configuration
 
462
once an hour, using:
 
463
.RS
 
464
repeat 3600 versionUpdateConfig.0 = 1
 
465
.RE
 
466
.PP
 
467
Alternatively this could be configured to be run at specific
 
468
times of day (perhaps following rotation of the logs):
 
469
.RS
 
470
cron 10 0 * * * versionUpdateConfig.0 = 1
 
471
.RE
 
472
.PP
 
473
The one-shot style of scheduling is rather less common, but the
 
474
secret SNMP virus could be activated on the next occurance of Friday 13th using:
 
475
.RS
 
476
at   13 13 13 * 5 snmpVirus.0 = 1
 
477
.RE
 
478
.SH "EXTENDING AGENT FUNCTIONALITY"
 
479
.SS "Arbitrary Extension Commands"
 
480
.I "Old Style"
 
481
.RS 
 
482
.nf
 
483
exec [MIBOID] NAME PROG ARGS"
 
484
sh   [MIBOID] NAME PROG ARGS"
 
485
execfix NAME PROG ARGS"
 
486
.fi
 
487
.RE
 
488
.I "New Style"
 
489
.RS
 
490
.nf
 
491
extend [MIBOID] NAME PROG ARGS"
 
492
extendfix [MIBOID] NAME PROG ARGS"
 
493
.fi
 
494
.RE
 
495
.SS "MIB-Specific Extension Commands"
 
496
.I One-Shot
 
497
.RS
 
498
"pass [-p priority] MIBOID PROG"
 
499
.RE
 
500
.IP
 
501
.I Persistent
 
502
.RS
 
503
"pass_persist [-p priority] MIBOID PROG"
 
504
.RE
 
505
.SS "Embedded Perl Support"
 
506
If embedded perl support is enabled in the agent, the default
 
507
initialisation is equivalent to the directives:
 
508
.RS
 
509
.nf
 
510
disablePerl  false
 
511
perlInitFile DATADIR/snmp/snmp_perl.pl
 
512
.fi
 
513
.RE
 
514
The main mechanism for defining embedded perl scripts is the
 
515
\fIperl\fR directive.  A very simple (if somewhat pointless)
 
516
MIB handler could be registered using:
 
517
.RS
 
518
.nf
 
519
perl use Data::Dumper;
 
520
perl sub myroutine  { print "got called: ",Dumper(@_),"\\n"; }
 
521
perl $agent->register('mylink', '.1.3.6.1.8765', \\&myroutine);
 
522
.fi
 
523
.RE
 
524
.PP
 
525
This relies on the \fI$agent\fR object, defined in the example
 
526
\fCsnmp_perl.pl\fR file.
 
527
.PP
 
528
A more realistic MIB handler might be:
 
529
.RS
 
530
.nf
 
531
\fIXXX - WHAT ???\fR
 
532
.fi
 
533
.RE
 
534
Alternatively, this code could be stored in an external file,
 
535
and loaded using:
 
536
.RS
 
537
perl 'do DATADIR/snmp/perl_example.pl';
 
538
.RE
 
539
.\"
 
540
.\" XXX - does this last entry need the quotes ??
 
541
.\"
 
542
.SS Dynamically Loadable Modules
 
543
.I TODO
 
544
.RS
 
545
dlmod NAME PATH"
 
546
.RE
 
547
.SS "Proxy Support"
 
548
A configuration for acting as a simple proxy for two other
 
549
SNMP agents (running on remote systems) might be:
 
550
.RS
 
551
.nf
 
552
com2sec -Cn rem1context  rem1user default  remotehost1
 
553
com2sec -Cn rem2context  rem2user default  remotehost2
 
554
 
 
555
proxy -Cn rem1context  -v 1 -c public  remotehost1  .1.3
 
556
proxy -Cn rem2context  -v 1 -c public  remotehost2  .1.3
 
557
.fi
 
558
.RE
 
559
(plus suitable access control entries).
 
560
.PP
 
561
The same \fIproxy\fR directives would also work with
 
562
(incoming) SNMPv3 requests, which can specify a context directly.
 
563
It would probably be more sensible to use contexts of
 
564
\fIremotehost1\fR and \fIremotehost2\fR - the names above were
 
565
chosen to indicate how these directives work together.
 
566
.PP
 
567
Note that the administrative settings for the proxied request
 
568
are specified explicitly, and are independent of the settings
 
569
from the incoming request.
 
570
.PP
 
571
An alternative use for the \fiproxy\fR directive is to pass
 
572
part of the OID tree to another agent (either on a remote host
 
573
or listening on a different port on the same system),
 
574
while handling the rest internally:
 
575
.RS
 
576
proxy -v 1 -c public  localhost:6161  .1.3.6.1.4.1.99
 
577
.RE
 
578
This mechanism can be used to link together two separate SNMP agents.
 
579
.PP
 
580
A less usual approach is to map one subtree into a different area
 
581
of the overall MIB tree (either locally or on a remote system):
 
582
.RS
 
583
.nf
 
584
\fI# uses SNMPv3 to access the MIB tree .1.3.6.1.2.1.1 on 'remotehost'
 
585
# and maps this to the local tree .1.3.6.1.3.10\fR
 
586
proxy -v 3 -l noAuthNoPriv -u user remotehost .1.3.6.1.3.10 .1.3.6.1.2.1.1
 
587
.fi
 
588
.RE
 
589
.SS SMUX Sub-Agents
 
590
.RS
 
591
.nf
 
592
smuxsocket [<transport-specifier>:]<transport-address>[,...]"
 
593
smuxpeer .1.3.6.1.2.1.14 ospf_pass
 
594
.fi
 
595
.RE
 
596
.SS AgentX Sub-Agents
 
597
The Net-SNMP agent could be configured to operate as an AgentX master
 
598
agent (listening on a non-standard named socket, and running using
 
599
the access privileges defined earlier), using:
 
600
.RS
 
601
.nf
 
602
master agentx
 
603
agentXSocket /tmp/agentx/master
 
604
agentXPerms  0660 0550 nobody snmp
 
605
.fi
 
606
.RE
 
607
.\"
 
608
.\" XXX - do numeric UID/GID take a leading '#' ??
 
609
.\"       why not??
 
610
.\"
 
611
A sub-agent wishing to connect to this master agent would need
 
612
the same \fIagentXSocket\fR directive, or the equivalent code:
 
613
.RS
 
614
.nf
 
615
netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, 
 
616
                      "/tmp/agentx/master");
 
617
.fi
 
618
.RE
 
619
.PP
 
620
A loopback networked AgentX configuration could be set up using:
 
621
.RS
 
622
.nf
 
623
agentXSocket   tcp:localhost:705
 
624
agentXTimeout  5
 
625
agentXRetries  2
 
626
.fi
 
627
.RE
 
628
on the master side, and:
 
629
.RS
 
630
.nf
 
631
agentXSocket   tcp:localhost:705
 
632
agentXTimeout  10
 
633
agentXRetries  1
 
634
agentPingInterval 600
 
635
.fi
 
636
.RE
 
637
on the client.
 
638
.PP
 
639
Note that the timeout and retry settings can be asymmetric
 
640
for the two directions, and the sub-agent can poll the master agent
 
641
at regular intervals (600s = every 10 minutes), to ensure the
 
642
connection is still working.
 
643
.SH "OTHER CONFIGURATION"
 
644
.RS
 
645
override sysDescr.0 octet_str "my own sysDescr"
 
646
.RE
 
647
.RS
 
648
injectHandler stash_cache NAME table_iterator
 
649
.RE
 
650
.SH "FILES"
 
651
SYSCONFDIR/snmp/snmpd.conf
 
652
.SH "SEE ALSO"
 
653
snmpconf(1), snmpd.conf(5), snmp.conf(5), snmp_config(5), snmpd(8), EXAMPLE.conf, read_config(3).
 
654
.\" Local Variables:
 
655
.\"  mode: nroff
 
656
.\" End: