1 |
27 |
unneback |
|
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 |
|
|
SNMP
|
34 |
|
|
|
35 |
|
|
SNMP for eCos
|
36 |
|
|
|
37 |
|
|
Version
|
38 |
|
|
|
39 |
|
|
This is a port of UCD-SNMP-4.1.2
|
40 |
|
|
|
41 |
|
|
Originally this document said: See
|
42 |
|
|
http://ucd-snmp.ucdavis.edu/
|
43 |
|
|
for details. And send them a postcard.
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
The project has since been renamed “net-snmp” and re-homed at
|
47 |
|
|
|
48 |
|
|
http://net-snmp.sourceforge.net/
|
49 |
|
|
where various new releases (of the original, not eCos
|
50 |
|
|
ports) are available.
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
The original source base from which we worked to create the
|
54 |
|
|
eCos port is available from various archive sites such
|
55 |
|
|
as
|
56 |
|
|
|
57 |
|
|
ftp://ftp.freesnmp.com/mirrors/net-snmp/
|
58 |
|
|
or
|
59 |
|
|
|
60 |
|
|
ftp://sunsite.cnlab-switch.ch/mirror/ucd-snmp/
|
61 |
|
|
generally with this filename and details:
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
ucd-snmp-4.1.2.tar.gz. . . . . . Nov 2 2000 1164k
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
SNMP packages in the eCos source repository
|
70 |
|
|
|
71 |
|
|
The SNMP/eCos package consists of two eCos packages;
|
72 |
|
|
the SNMP library and the SNMP agent.
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
The sources are arranged this way partly for consistency with
|
76 |
|
|
the original release from UCD, and so as to accommodate possible
|
77 |
|
|
future use of the SNMP library without having an agent present.
|
78 |
|
|
That could be used to build an eCos-based SNMP client application.
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
The library contains support code for talking SNMP over the
|
82 |
|
|
net - the SNMP protocol itself - and a MIB file parser (ASN-1) which
|
83 |
|
|
is not used in the agent case.
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
The agent contains the application specific handler files
|
87 |
|
|
to get information about the system into the SNMP world, together
|
88 |
|
|
with the SNMP agent thread
|
89 |
|
|
(snmpd in UNIX terms).
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
MIBs supported
|
94 |
|
|
|
95 |
|
|
The standard set in MIB-II, together with the Ether-Like MIB, are supported
|
96 |
|
|
by default. The MIB files used to compile the handlers in the agent and to
|
97 |
|
|
“drive” the testing (snmpwalk et
|
98 |
|
|
al under LINUX)
|
99 |
|
|
are those acquired from that same UCD distribution.
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
These are the supported MIBs; all are below mib2 == 1.3.6.1.2.1:
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
system { mib2 1 }
|
106 |
|
|
interfaces { mib2 2 }
|
107 |
|
|
[ address-translation “at” { mib2 3 } is deprecated ]
|
108 |
|
|
ip { mib2 4 }
|
109 |
|
|
icmp { mib2 5 }
|
110 |
|
|
tcp { mib2 6 }
|
111 |
|
|
udp { mib2 7 }
|
112 |
|
|
[ exterior gateway protocol “egp” { mib2 8 } not supported ]
|
113 |
|
|
[ cmot { mib2 9 } is “historic”, just a placeholder ]
|
114 |
|
|
dot3 { mib2 10 7 } == { transmission 7 } “EtherLike MIB”
|
115 |
|
|
snmp { mib2 11 }
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
On inclusion of SNMPv3 support packages, the following MIBs are added to the
|
119 |
|
|
default set of MIBs enumerated above :
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
snmpEngine { snmpFrameworkMIBObjects 1 } SNMP-FRAMEWORK-MIB, as described in
|
123 |
|
|
RFC-2571 for support of SNMPv3
|
124 |
|
|
framework.
|
125 |
|
|
|
126 |
|
|
usmStats { usmMIBObjects 1 } SNMP-USER-BASED-SM-MIB, as
|
127 |
|
|
usmUser { usmMIBObjects 2 } specified in RFC-2574 for support
|
128 |
|
|
of user based security model in
|
129 |
|
|
SNMPv3 management domains.
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
Changes to eCos sources
|
134 |
|
|
|
135 |
|
|
Small changes have been made in three areas:
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
Various hardware-specific ethernet drivers.
|
139 |
|
|
The generic ethernet device driver.
|
140 |
|
|
The OpenBSD TCP/IP networking package.
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
These changes were made in order to export information about the driver and
|
144 |
|
|
the network that the SNMP agent must report. The changes were trivial in
|
145 |
|
|
the case of the network stack, since it was already SNMP-friendly. The
|
146 |
|
|
generic ethernet device driver was re-organized to have an extensive header
|
147 |
|
|
file and to add a couple of APIs to extract statistics that the
|
148 |
|
|
hardware-specific device drivers keep within themselves.
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
There may be a performance hit for recording that data; disabling
|
152 |
|
|
a config option named something like
|
153 |
|
|
CYGDBG_DEVS_ETH_xxxx_xxxx_KEEP_STATISTICS
|
154 |
|
|
depending on the specific device driver will prevent that.
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
Not all platform ethernet device drivers export complete SNMP statistical
|
158 |
|
|
information; if the exported information is missing, SNMP will report zero
|
159 |
|
|
values for such data (in the dot3 MIB).
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
The interface chipset has an ID which is an OID; not all the latest greatest
|
163 |
|
|
devices are listed in the abailable database, so new chipsets may need to
|
164 |
|
|
be added to the client MIB, if not defined in those from UCD.
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
Starting the SNMP Agent
|
169 |
|
|
|
170 |
|
|
A routine to instantiate and start the SNMP agent thread in the default
|
171 |
|
|
configuration is provided in
|
172 |
|
|
PACKAGES/net/snmp/agent/VERSION/src/snmptask.c
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
It starts the snmpd thread at priority
|
176 |
|
|
CYGPKG_NET_THREAD_PRIORITY+1
|
177 |
|
|
by default, ie. one step less important than the TCP/IP stack service
|
178 |
|
|
thread.
|
179 |
|
|
It also statically creates and uses a very large stack of around 100
|
180 |
|
|
KiloBytes.
|
181 |
|
|
To use that convenience function, this code fragment may be copied (in
|
182 |
|
|
plain C).
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
#ifdef CYGPKG_SNMPAGENT
|
186 |
|
|
{
|
187 |
|
|
extern void cyg_net_snmp_init(void);
|
188 |
|
|
cyg_net_snmp_init();
|
189 |
|
|
|
190 |
|
|
}
|
191 |
|
|
#endif
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
In case you need to perform initialization, for example setting up SNMPv3
|
195 |
|
|
security features, when the snmp agent starts and every time it restarts,
|
196 |
|
|
you can register a callback function by simply writing the global variable:
|
197 |
|
|
|
198 |
|
|
externC void (*snmpd_reinit_function)( void );
|
199 |
|
|
|
200 |
|
|
with a suitable function pointer.
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
The entry point to the SNMP agent is
|
204 |
|
|
|
205 |
|
|
externC void snmpd( void (*initfunc)( void ) );
|
206 |
|
|
|
207 |
|
|
so you can of course easily start it in a thread of your choice at another
|
208 |
|
|
priority instead if required, after performing whatever other
|
209 |
|
|
initialization your SNMP MIBs need. A larger than default stacksize is
|
210 |
|
|
required. The initfunc parameter is the callback
|
211 |
|
|
function mentioned above — a NULL parameter there is safe and
|
212 |
|
|
obviously means no callback is registered.
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
Note that if you call snmpd(); yourself and do
|
216 |
|
|
not call cyg_net_snmp_init(); then
|
217 |
|
|
that routine, global variable, and the default large stack will not be
|
218 |
|
|
used. This is the recommended way control such features from your
|
219 |
|
|
application; create and start the thread yourself at the appropriate
|
220 |
|
|
moment.
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
Other APIs from the snmpd module are available,
|
224 |
|
|
specifically:
|
225 |
|
|
|
226 |
|
|
void SnmpdShutDown(int a);
|
227 |
|
|
|
228 |
|
|
which causes the snmpd to restart itself —
|
229 |
|
|
including the callback to your init function — as soon as possible.
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
The parameter a is ignored. It is there because in
|
233 |
|
|
snmpd's “natural environment” this routine
|
234 |
|
|
is a UNIX signal handler.
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
The helper functions in the network stack for managing
|
238 |
|
|
DHCP
|
239 |
|
|
leases will call SnmpdShutDown()
|
240 |
|
|
when necessary, for example if network interfaces go down and/or come up
|
241 |
|
|
again.
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
Configuring eCos
|
246 |
|
|
|
247 |
|
|
To use the SNMP agent, the SNMP library and agent packages must be
|
248 |
|
|
included in your configuration. To incorporate the stack into your
|
249 |
|
|
configuration select the SNMP library and SNMP agent packages in the
|
250 |
|
|
eCos Configuration Tool, or at the command line type:
|
251 |
|
|
|
252 |
|
|
$ ecosconfig add snmplib snmpagent
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
After adding the networking, common ethernet device drivers,
|
257 |
|
|
snmp library and snmp agent packages, there is no configuration
|
258 |
|
|
required. However there are a number of configuration options
|
259 |
|
|
that can be set such as some details for the System MIB, and
|
260 |
|
|
disabling SNMPv3 support (see below).
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
Starting the SNMP agent is not integrated into network
|
264 |
|
|
tests other than snmpping below, nor is it
|
265 |
|
|
started automatically in normal eCos startup -
|
266 |
|
|
it is up to the application to start the agent when it is ready,
|
267 |
|
|
at least after the network interfaces are both ‘up’.
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
Version usage (v1, v2 or v3)
|
271 |
|
|
|
272 |
|
|
The default build supports all three versions of the SNMP protocol, but without
|
273 |
|
|
any dispatcher functionality (rfc 2571, section 3.1.1.2). This has the
|
274 |
|
|
following implications :
|
275 |
|
|
|
276 |
|
|
1. There is no community authentication for v1 and v2c.
|
277 |
|
|
2. Security provided by v3 can be bypassed by using v1/v2c protocol.
|
278 |
|
|
|
279 |
|
|
To provide the dispatcher with rfc 2571 type functionality, it is required to
|
280 |
|
|
set up security models and access profiles. This can be provided in the normal
|
281 |
|
|
Unix style by writing the required configurations in snmpd.conf
|
282 |
|
|
file. Application code may setup profiles in snmpd.conf and
|
283 |
|
|
optionally set the environment variable SNMPCONFPATH to
|
284 |
|
|
point to the file if it is not in the usual location. The whole concept works
|
285 |
|
|
in the usual way as with the standard UCD-SNMP distribution.
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
Traps
|
290 |
|
|
|
291 |
|
|
The support of the trapsink command in the
|
292 |
|
|
snmpd.conf file is not tested
|
293 |
|
|
and there may be problems for it working as expected. Moreover, in systems that do not
|
294 |
|
|
have filesystem support, there is no way to configure a trap-session in the
|
295 |
|
|
conventional way.
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
For reasons mentioned above, applications need to initialize their own trap
|
299 |
|
|
sessions and pass it the details of trap-sink. The following is a small sample
|
300 |
|
|
for initializing a v1 trap session :
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
typedef struct trap {
|
304 |
|
|
unsigned char ip [4];
|
305 |
|
|
unsigned int port;
|
306 |
|
|
unsigned char community [256];
|
307 |
|
|
}
|
308 |
|
|
|
309 |
|
|
trap trapsink;
|
310 |
|
|
unsinged char sink [16];
|
311 |
|
|
|
312 |
|
|
...
|
313 |
|
|
...
|
314 |
|
|
|
315 |
|
|
if (trapsink.ip != 0) {
|
316 |
|
|
sprintf (sink, "%d.%d.%d.%d",
|
317 |
|
|
trapsink[0], trapsink[1], trapsink[2], trapsink[3]);
|
318 |
|
|
if (create_trap_session (sink,
|
319 |
|
|
trapsink.port,
|
320 |
|
|
(char *)trapsink.community,
|
321 |
|
|
SNMP_VERSION_1,
|
322 |
|
|
SNMP_MSG_TRAP) == 0) {
|
323 |
|
|
log_error ("Creation of trap session failed \n");
|
324 |
|
|
}
|
325 |
|
|
}
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|
|
snmpd.conf file
|
330 |
|
|
|
331 |
|
|
Using snmpd.conf requires the inclusion of one of the file-system packages
|
332 |
|
|
(eg. CYGPKG_RAMFS) and CYGPKG_FILEIO. With these two packages included, the
|
333 |
|
|
SNMP sub-system will read the snmpd.conf file from the location specified in
|
334 |
|
|
SNMPCONFPATH, or the standard builtin locations, and use
|
335 |
|
|
these profiles. Only the profiles specified in the ACCESS-CONTROL
|
336 |
|
|
section of snmpd.conf file have
|
337 |
|
|
been tested and shown to work. Other profiles which have been implemented in
|
338 |
|
|
UCD-SNMP-4.1.2's snmpd.conf may not work
|
339 |
|
|
because the sole purpose of adding support for the snmpd.conf file has been to
|
340 |
|
|
set up ACCESS-CONTROL models.
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
At startup, the SNMP module tries to look for file snmp.conf.
|
344 |
|
|
If this file is not available, the module successively looks for files
|
345 |
|
|
snmpd.conf, snmp.local.conf and
|
346 |
|
|
snmpd.local.conf at the locations pointed to by
|
347 |
|
|
SNMPCONFPATH environment variable. In case SNMPCONFPATH
|
348 |
|
|
is not defined, the search sequence is carried out in default directories.
|
349 |
|
|
The default directories are :/usr/share/snmp,
|
350 |
|
|
/usr/local/share/snmp and $(HOME)/.snmp.
|
351 |
|
|
The configurations read from these files are used to control both, SNMP
|
352 |
|
|
applications and the SNMP agent; in the usual UNIX fashion.
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
The inclusion of snmpd.conf support is enabled by default when suitable
|
356 |
|
|
filesystems and FILEIO packages are active.
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
Test cases
|
362 |
|
|
|
363 |
|
|
Currently only one test program is provided which uses SNMP.
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
"snmpping" in the SNMP agent package runs the ping test from
|
367 |
|
|
the TCPIP package, with the snmpd running also. This allows you
|
368 |
|
|
to interrogate it using host tools of your choice. It supports MIBs
|
369 |
|
|
as documented above, so eg. snmpwalk
|
370 |
|
|
<hostname> public dot3 under
|
371 |
|
|
Linux/UNIX should have the desired effect.
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
For serious testing, you should increase the length of time
|
375 |
|
|
the test runs by setting CYGNUM_SNMPAGENT_TESTS_ITERATIONS
|
376 |
|
|
to something big (e.g., 999999). Build the test
|
377 |
|
|
(make -C net/snmp/agent/current tests)
|
378 |
|
|
and run it on the target.
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
Then start several jobs, some for pinging the board (to make
|
382 |
|
|
the stats change) and some for interrogating the snmpd. Set $IP
|
383 |
|
|
to whatever IP address the board has:
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
# in a root shell, for flood ping
|
387 |
|
|
while(1)
|
388 |
|
|
date
|
389 |
|
|
ping -f -c 3001 $IP
|
390 |
|
|
sleep 5
|
391 |
|
|
ping -c 32 -s 2345 $IP
|
392 |
|
|
end
|
393 |
|
|
|
394 |
|
|
# have more than one of these going at once
|
395 |
|
|
setenv MIBS all
|
396 |
|
|
while (1)
|
397 |
|
|
snmpwalk -OS $IP public
|
398 |
|
|
date
|
399 |
|
|
end
|
400 |
|
|
|
401 |
|
|
Leave to run for a couple of days or so to test stability.
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
The test program can also test snmpd.conf support. It tries to build a minimal
|
405 |
|
|
snmpd.conf file on a RAM filesystem and passes it to the snmp sub-system. With
|
406 |
|
|
this profile on target, the following snmp[cmd] (cmd=walk, get, set) should
|
407 |
|
|
work :
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
snmp[cmd] -v1 $IP crux $OID
|
411 |
|
|
snmp[cmd] -v2 $IP crux $OID
|
412 |
|
|
snmp[cmd] -v3 $IP -u root -L noAuthNoPriv $OID
|
413 |
|
|
snmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a md5passwd $OID
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
The following commands would however fail since they violate the access model :
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
snmp[cmd] $IP public $OID
|
420 |
|
|
snmp[cmd] -v1 $IP public $OID
|
421 |
|
|
snmp[cmd] -v2c $IP public $OID
|
422 |
|
|
snmp[cmd] -v3 $IP -u no_user -L noAuthNoPriv $OID
|
423 |
|
|
snmp[cmd] -v3 $IP -u root -L authNoPriv -A MD5 -a badpasswd $OID
|
424 |
|
|
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
SNMP clients and package use
|
428 |
|
|
|
429 |
|
|
SNMP clients may use these packages, but this usage is currently
|
430 |
|
|
untested: the reason why this port to eCos exists is to acquire
|
431 |
|
|
the SNMP agent. The fact that that the SNMP API (for clients) exists
|
432 |
|
|
is a side-effect. See the standard man page SNMP_API(3)
|
433 |
|
|
for details. There are further caveats below about client-side
|
434 |
|
|
use of the SNMP library.
|
435 |
|
|
|
436 |
|
|
|
437 |
|
|
All of the SNMP header files are installed beneath .../include/ucd-snmp
|
438 |
|
|
in the install tree. The SNMP code itself assumes that directory
|
439 |
|
|
is on its include path, so we recommend that client code does the
|
440 |
|
|
same. Further, like the TCP/IP stack, compiling SNMP code
|
441 |
|
|
requires definition of _KERNEL and __ECOS,
|
442 |
|
|
and additionally IN_UCD_SNMP_SOURCE.
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
Therefore, add all of these to your compile lines if you wish
|
446 |
|
|
to include SNMP header files:
|
447 |
|
|
|
448 |
|
|
-D_KERNEL
|
449 |
|
|
-D__ECOS
|
450 |
|
|
-DIN_UCD_SNMP_SOURCE=1
|
451 |
|
|
-I$(PREFIX)/include/ucd-snmp
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
Unimplemented features
|
455 |
|
|
|
456 |
|
|
Currently, the filesystem and persistent storage areas are
|
457 |
|
|
left undone, to be implemented by the application.
|
458 |
|
|
|
459 |
|
|
|
460 |
|
|
The SNMP library package is intended to support client and
|
461 |
|
|
agent code alike. It therefore contains lots of assumptions about
|
462 |
|
|
the presence of persistent storage ie. a filesystem. Currently,
|
463 |
|
|
by default, eCos has no such thing, so those areas have been simply
|
464 |
|
|
commented out and made to return empty lists or say “no
|
465 |
|
|
data here.”
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
Specifically the following files have omitted/unimplemented code :
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
PACKAGES/net/snmp/lib/VERSION/src/parse.c
|
472 |
|
|
|
473 |
|
|
|
474 |
|
|
contains code to enumerate MIB files discovered in the system
|
475 |
|
|
MIB directories (“/usr/share/snmp/mibs”),
|
476 |
|
|
and read them all in, building data structures that are used by
|
477 |
|
|
client programs to interrogate an agent. This is not required in
|
478 |
|
|
an agent, so the routine which enumerates the directories returns
|
479 |
|
|
an empty list.
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
PACKAGES/net/snmp/lib/VERSION/src/read_config.c
|
483 |
|
|
contains two systems:
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
The first tries to read the configuration file as described in the
|
487 |
|
|
snmpd.conf file section and
|
488 |
|
|
the second system contains code to record persistent data as files in a
|
489 |
|
|
directory (typically /var/ucd-snmp) thus preserving the
|
490 |
|
|
state permanently.
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
The first part is partially implemented to support multiple profiles and enables
|
494 |
|
|
dispatcher functionality as discussed in .
|
495 |
|
|
The second part is not supported at all in the default implementation. As required,
|
496 |
|
|
a cleaner interface to permit application code to manage persistent data will be
|
497 |
|
|
developed in consultation with customers.
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
MIB Compiler
|
502 |
|
|
In the directory
|
503 |
|
|
/snmp/agent/VERSION/utils/mib2c,
|
504 |
|
|
there are the following files:
|
505 |
|
|
|
506 |
|
|
README-eCos notes about running with a nonstandard
|
507 |
|
|
perl path.
|
508 |
|
|
README.mib2c the README from UCD; full instructions on
|
509 |
|
|
using mib2c
|
510 |
|
|
mib2c the perl program
|
511 |
|
|
mib2c.conf a configuration file altered to include the
|
512 |
|
|
eCos/UCD
|
513 |
|
|
mib2c.conf-ORIG copyright and better #include paths; and
|
514 |
|
|
the ORIGinal.
|
515 |
|
|
mib2c.storage.conf other config files, not modified.
|
516 |
|
|
mib2c.vartypes.conf
|
517 |
|
|
|
518 |
|
|
|
519 |
|
|
mib2c is provided BUT it requires the SNMP perl package SNMP-3.1.0,
|
520 |
|
|
and that in turn requires perl nsPerl5.005_03 (part of
|
521 |
|
|
Red Hat Linux from 6.0, April 1999).
|
522 |
|
|
These are available from the CPAN (“the Comprehensive
|
523 |
|
|
Perl Archive Network”) as usual;
|
524 |
|
|
http://www.cpan.org/
|
525 |
|
|
and links from there. Specifically:
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
|
|
PERL itself:
|
530 |
|
|
|
531 |
|
|
http://people.netscape.com/kristian/nsPerl/
|
532 |
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
|
|
http://people.netscape.com/richm/nsPerl/nsPerl5.005_03-11-i686-linux.tar.gz
|
536 |
|
|
|
537 |
|
|
|
538 |
|
|
SNMP.pl
|
539 |
|
|
|
540 |
|
|
http://www.cpan.org/modules/01modules.index.html
|
541 |
|
|
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
http://cpan.valueclick.com/modules/by-category/05_Networking_Devices_IPC/SNMP/
|
545 |
|
|
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
http://www.cpan.org/authors/id/G/GS/GSM/SNMP.tar.gz
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
(note that the .tar.gz files are not browsable)
|
552 |
|
|
|
553 |
|
|
For documentation on the files produced, see the documentation
|
554 |
|
|
available at
|
555 |
|
|
http://ucd-snmp.ucdavis.edu/
|
556 |
|
|
|
557 |
|
|
in general, and file AGENT.txt in particular.
|
558 |
|
|
|
559 |
|
|
|
560 |
|
|
It is likely that the output of mib2c will be further customized
|
561 |
|
|
depending on eCos customer needs; it’s easy to do this
|
562 |
|
|
by editing the mib2c.conf file to add or remove whatever you need
|
563 |
|
|
with the resulting C sources.
|
564 |
|
|
|
565 |
|
|
|
566 |
|
|
The UCD autoconf-style configuration does not apply to eCos.
|
567 |
|
|
So if you add a completely new MIB to the agent, and support it
|
568 |
|
|
using mib2c so that the my_new_mib.c file contains
|
569 |
|
|
a init_my_new_mib() routine to register
|
570 |
|
|
the MIB handler, you will also need to edit a couple of control
|
571 |
|
|
files; these claim to be auto-generated, but in the eCos release,
|
572 |
|
|
they’re not, don’t worry.
|
573 |
|
|
|
574 |
|
|
PACKAGES/net/snmp/agent/VERSION/include/mib_module_includes.h
|
575 |
|
|
|
576 |
|
|
contains a number of lines like
|
577 |
|
|
|
578 |
|
|
#include “mibgroup/mibII/interfaces.h”
|
579 |
|
|
|
580 |
|
|
so add your new MIB thus:
|
581 |
|
|
|
582 |
|
|
#include “mibgroup/mibII/my_new_mib.h”
|
583 |
|
|
PACKAGES/net/snmp/agent/VERSION/include/mib_module_inits.h
|
584 |
|
|
|
585 |
|
|
contains a number of lines like
|
586 |
|
|
|
587 |
|
|
init_interfaces();
|
588 |
|
|
init_dot3();
|
589 |
|
|
|
590 |
|
|
and so on; add your new MIB as follows:
|
591 |
|
|
|
592 |
|
|
init_my_new_mib();
|
593 |
|
|
|
594 |
|
|
and this should work correctly.
|
595 |
|
|
|
596 |
|
|
|
597 |
|
|
|
598 |
|
|
&net-snmp-agent-snmp-manpages-sgml
|
599 |
|
|
|
600 |
|
|
|