What's the ideal AgentX++ subagent loop?

Hi,

I am investigating unexplained timeouts, and other odd behaviour (i.e. snmpset randomly failing immediately with ENOCREATION) (I am using UNIX sockets)

Both our master agent and subagent processing loops are the same:

      while (agent_running && (!mib->get_agentx()->quit()))
      {
         Agentpp::Request *req = reqList->receive(1);
         if (req)
         {
            mib->process_request(req);
         }
         else if ((reqList->size() == 0) &&
               (mib->get_thread_pool()->is_idle()))
         {
            mib->cleanup();
         }
      }

Looking at the example master.cpp, subagent.cpp and subagent2.cpp in AgentX++2.6.1 there are some notable differences:

  • the reqList->receive() timeouts are 20000 for subagent1, 40000 for subagent 2, but only 2 for master
  • subagent2 calls reqList->terminate_set_requests()
  • subagent1 uses ping_master() but subagent2 does not
  • mib->cleanup() logic is only done by the master and subagent2.

What would be really useful, is the golden example of master and subagent loops.

Thanks in advance

Steve