Hello!

I had reported problems with registering an AgentX subagent in Perl (no error, 
but doesn't work). Finally I found the bug that prevented it from working.

Now I have a C program that uses multiple threads to retrieve and monitor some 
values. I tried to make this program an AgentX subagent by adding the code from 
the C coding example. Unfortunately the same things as in Perl happen: The 
agent does not connect, and there is no error. When trying to access any of the 
registered OIDs, an error is returned. None of the handlers is ever called.

What I'd like to have eventually is that one thread takes care of all the SNMP 
handling.

>From the example I guess that the API is too high-level (init_agent()): It's 
>hard to see which steps are actually executed, and what the results of these 
>steps are.

What could the problem be, and how could I debug it?

The essential code fragemnt looks like this:
                /*BEGIN SNMP*/
                /* prepare for AgentX subagent */
                if ( netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
                                            NETSNMP_DS_AGENT_ROLE, 1)
                     != SNMPERR_SUCCESS )
                {
                        /* report problem */
                }
                SOCK_STARTUP;           /* initialize TCP/IP, if necessary */
                init_agent("iotwatch"); /* initialize the agent library */
                init_IOTWatchMIB();     /* initialize MIB module */
                while ( stop_requests == 0 ) {
                        agent_check_and_process(1); /* 0 == don't block */
                }

                /* at shutdown time */
                snmp_shutdown("iotwatch");
                SOCK_CLEANUP;
                /*END SNMP*/

Regards,
Ulrich



------------------------------------------------------------------------------
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to