Hi,
I want to write a dynamically loadable object.
I downloaded the example (including: Makefile, NET-SNMP-TUTORIAL-MIB.txt,
nstAgentPluginObject.h, nstAgentPluginObject.c) from net-snmp offical website.
I did it step by step as following:
Steps to test the shared object via runtime MIB configuration
1.. Start the snmpd and watch the dlmod and nstAgentPluginObject modules
interact using the debugging flag (this assumes you already have access control
set up properly for your agent):
% snmpd -f -L -DnstAgentPluginObject,dlmod
2.. In another window, test to make sure that the agent doesn't currently
support the nstAgentPluginObject (if you get different results running this
command you need to recompile the net-snmp agent without the
nstAgentPluginObject mib module compiled in directly):
% snmpget localhost NET-SNMP-TUTORIAL-MIB::nstAgentPluginObject.0
nstAgentPluginObject.0 = No Such Object available on this agent at this OID
3.. Then, run snmpset to create a new row in the dlmod table:
% snmpset localhost UCD-DLMOD-MIB::dlmodStatus.1 i create
dlmodStatus.1 = create(6)
4.. See that the row was created:
% snmptable localhost UCD-DLMOD-MIB::dlmodTable
SNMP table: dlmodTable
dlmodName dlmodPath dlmodError dlmodStatus
unloaded
5.. Then set the properties of the row up to point to our new object and to
give it a name:
% snmpset localhost UCD-DLMOD-MIB::dlmodName.1 s "nstAgentPluginObject"
UCD-DLMOD-MIB::dlmodPath.1 s "/path/to/nstAgentPluginObject.so"
dlmodName.1 = "nstAgentPluginObject"
dlmodName.1 = "/path/to/nstAgentPluginObject.so"
% snmptable localhost UCD-DLMOD-MIB::dlmodTable
SNMP table: dlmodTable
dlmodName dlmodPath dlmodError dlmodStatus
nstAgentPluginObject /path/to/nstAgentPluginObject.so unloaded
6.. Finally, load the shared object into the running agent:
% snmpset localhost UCD-DLMOD-MIB::dlmodStatus.1 i load
dlmodStatus.1 = loaded(1)
% snmptable localhost UCD-DLMOD-MIB::dlmodTable
SNMP table: dlmodTable
dlmodName dlmodPath dlmodError dlmodStatus
nstAgentPluginObject /path/to/nstAgentPluginObject.so loaded
7.. If everything above was done correctly, then the following command should
work and will access the shared object's data:
% snmpget localhost NET-SNMP-TUTORIAL-MIB::nstAgentPluginObject.0
nstAgentPluginObject.0 = INTEGER: 3
But I got an error in step 6. It showed "SNMP table: UCD-DLMOD-MIB::dlmodTable
dlmodName dlmodPath
dlmodError dlmodStatus
nstAgentModuleObject /home/net-snmp-module-example/nstAgentModuleObject.so
dlopen failed: /home/net-snmp-module-example/nstAgentModuleObject.so: undefined
symbol: snmp_get_do_debugging error
".
I tried hard to find some disscussion about this, but I couldn't find a
solution.
Could you help me to resolve this problem? What's wrong with my steps? Or there
is something important I missed? Thanks a lot!!!
Sincerely,
iTAS Tewen
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders