I will try to hgive an answer using some example
I assume we have a link named /net-snmp to tha base installation of  the
snmp product

[EMAIL PROTECTED] enzo]$ ls -la /net-snmp
lrwxrwxrwx    1 root     root           31 apr 14 13:18 /net-snmp ->
/home/enzo/SNMP/net-snmp-5.0.8/


Under /net-snmp/agent/mibgroup you should have the files related to your
customization.

You need one header with some directive of the file you will compile , as
show belowe.


[EMAIL PROTECTED] enzo]$ cat /net-snmp/agent/mibgroup/enzo.h
/*
 * enzo.h: top level .h file to merely include the sub-module.
 */
config_require(enzo/enzo)

config_require(enzo/crTableDevices)
config_require(enzo/crProcTable)

config_add_mib(ENZO-MIB)

The subdir 'enzo' contains all your *.c and *.h files of your customization

[EMAIL PROTECTED] enzo]$ ls  /net-snmp/agent/mibgroup/enzo
enzo.c   enzo.o   crProcTable.lo    crTableDevices.h   globdata.h
enzo.h   crProcTable.c  crProcTable.o     crTableDevices.lo  last_update.h
enzo.lo  crProcTable.h  crTableDevices.c  crTableDevices.o
snmp_ipc_memory.h

Copy your mib files under /usr/local/share/snmp/mibs
ex. /usr/local/share/snmp/mibs/ENZO-MIB.txt

The first time you compile the customization you need to run config as
follow
$ cd /net-snmp
$ ./configure --with-mib-modules=enzo

then run make form /net-snmp directory
$ make


For all subsequent compilation, because you modify the source files, simply
compile  using make installlocallibs
from the subdirs agent

[EMAIL PROTECTED] enzo]$ cd /net-snmp/agent
[EMAIL PROTECTED] root]# make installlocallibs


Let me kown if all works
Bye,

Enzo Arlati [EMAIL PROTECTED]
AESYS Via Artigiani, 41 24060 Brusaporto (BG) - Italy
Tel. +39 (0)35.2924.182 Fax +39 (0)35 680030

 -----Messaggio originale-----
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto di Rana
Inviato: giovedì 29 luglio 2004 4.22
A: [EMAIL PROTECTED]
Oggetto: How to link a code with an OID


Hi All,
   I am very new to SNMP. To have a hold on SNMP, I planned to use net-snmp.
I am using Red Hat Linux Advanced Server(kernel 2.4.21-4). I am using the
net-snmp package which by default comes with this distribution of Linux. I
have crated a sample mib file. Using the mib2c I am able to generate the
corresponding .c and .h files. Can anyone suggest me citing some example how
can link my .c and .h files with the main snmp package, so that I can set
and get the values of the OIDs present in my Sample mib file using the
snmpget and snmpset command.
   If I modify my .c file what command should I use to recompile my .c file,
so that I can use the snmpget and snmpset commands from remote machine to
get and set the values of my OIDs. I want to execute a code which will take
the value of an OID from a file whenever an snmpget request is made.

Thanks and Regards,
Rana.




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_idG21&alloc_id040&op=click
_______________________________________________
Net-snmp-users mailing list
[EMAIL PROTECTED]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to