1) Yes, when I perform "make example-demon" then the following is produced:

gcc -I. `net-snmp-config --cflags`   -c -o example-demon.o example-demon.c
gcc -I. `net-snmp-config --cflags`   -c -o nstAgentSubagentObject.o 
nstAgentSubagentObject.c
gcc -o example-demon example-demon.o nstAgentSubagentObject.o  `net-snmp-config 
--agent-libs`

I can then perform a "snmpget" request nd the desired data is displayed..


2) Ok, so what would my next step be to have my complete MIB tree processed by 
a subagent?   

Would I need to copy the "example-demon.c" file, rename it to something like 
"myOcStbHostMib-demon.c" and edit it with my specific information.   I am 
confused as to where the "example-demon.c" file came from.  Was this file 
created for the sole purpose of showing an example of a subagent or must I copy 
this file and tweak it for use for my specific MIB?

Also, it seems I would need to create a routine similiar to the 
"init_nstAgentSubagentObject()" routine which can be called by the 
"myOcStbHostMib-demon" subagent? DO I create a completely new ".c" file for 
this and place it somewhere, or do I simply call the 
"netsnmp_register_int_instance()" routine from within one of my existing MfD 
code routines somewhere?

I am obviously not clear how to take my existing MfD code and combine it with 
some "example.c" and "nstAgentSubagentObject.c" code and get it working.

Also will by existing container_load() and row_prep() routines be called as 
normal to handle the snmp requests from the subagent or must I have to rewrite 
the code somehow?  I am confused how this all fits together.  What MfD code 
areas need to change to do this?




Dave Shield <[EMAIL PROTECTED]> wrote: On 13/06/07, Need Help  wrote:
> I did see when the "make example-demon" command executed then the it
> generates the following files:
>
> example-demon.o
> nstAgentSubagentObject.o

You should see the following three commands:

    cc   -c -o example-demon.o example-demon.c
    cc   -c -o nstAgentSubagentObject.o nstAgentSubagentObject.c
    cc       -o example-demon  example-demon.o nstAgentSubagentObject.o

(with the various compilation flags, etc)

Is that what you see or not?



> .... however, I do not understand how the subagent informs the snmpd master
> agent that all SNMP request relating to the NET-SNMP-TUTORIAL-MIB should be
> sent to the subagent instead of being processed by the snmpd master agent.

The 'nstAgentSubagentObject' module initialisation code will register with the
local subagent framework (example-demon.o) to inform it of the MIB modules it
wishes to handle (i.e. an OID subtree).  This is a standard part of the Net-SNMP
agent processing.
   In this case, this is the netsnmp_register_int_instance() call.

   The subagent framework makes a note of this OID registration locally (so it
knows which module to use), and also sends an AgentX registration request
to the master agent.  This is part of the standard AgentX protocol.

   The AgentX processing module of the master agent receives this AgentX
registration request, and registers this OID subtree with the main master
agent framework.  Again, this is a normal part of the Net-SNMP agent processing.
The main agent doesn't actually care that this is an AgentX registration - it
simply knows to send requests to this particular handler (which happens to
be the AgentX module).

When a GET (or GETNEXT) request comes in, the master agent looks up the
OID in its local registry, and passes the request to the appropriate module.
The AgentX module then forwards this request to the subagent, which looks
up the OID in *its* local registry, and passes the request on to the
appropriate local module (nstAgentSubagentObject).
   In this particular case, there isn't actually any specific code needed to
implement the object (since it's using the 'int_instance' helper).   But in
your MfD examples, this would be the  xxx_handler() routine.



Try it - see whether it works or not.

Dave


       
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to