Hi all,

I am currently using net-snmp V5.5 (CentOS 6.2, 32 bit).

I have programmed (in C++) a tool to
- provide data interface as SNMP AgentX (boost thread), by calling 
agent_check_and_process(1)
- listen to broadcast message on specific UDP port (boost io, boost thread)

I am running the tool as linux daemon.

Sometimes I've got a problem that at startup my tool does not receive the UDP 
broadcast messages (this seems to be only a startup problem).

If I disable the SNMP AgentX checking (do not call agent_check_and_process), 
everything is working all right and I receive the UDP broadcast message all 
the time.

I discovered that, if I first start the snmp AgentX thread before initializing 
and starting the UDP broadcast listener thread, the problem occurs frequently 
(e.g. 5 of 10 times). If I first initialize and start the UDP broadcast 
listener thread, the problem occurs less (but it occurs).

What can I do to overcome this problem?
Is there a configuration option or startup handling?

My SNMP AgentX configuration is (copied from NET-SNMP examples) shown below.

Thanks in advance and best regards,
Georg

--------------------------
        SnmpAgentX::SnmpAgentX()
        {
                int agentx_subagent=1;
                int background = 0;
                int syslog = 0;
                if (syslog)
                        snmp_enable_calllog();
                else
                        snmp_enable_stderrlog();

                if (agentx_subagent) {
                        netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, 
NETSNMP_DS_AGENT_ROLE, 1);
                }

                if (background && netsnmp_daemonize(1, !syslog))
                        exit(1);

                // SOCK_STARTUP; -> done in main()

                init_agent("SnmpAgentX");

                mib_handler_.MibHandlerInit();

                if (!agentx_subagent) {
                        init_vacm_vars();
                        init_usmUser();
                }

                init_snmp("SnmpAgentX");

                if (!agentx_subagent)
                        init_master_agent();

                is_thread_running_ = true;
                thread_ = boost::shared_ptr<boost::thread> (new 
boost::thread(boost::bind(&SnmpAgentX::Thread, this)));
        }

        void SnmpAgentX::Thread()
        {
                while (is_thread_running_)
                {
                        agent_check_and_process(1); // block to avoid risk of 
data loss 
and reduce cpu occupation
                }
        }



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
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