Hi,

 

I am having trouble with duplicate traps being sent.  I send one trap and two are received.  Can somebody please explain if I am doing something wrong here or if this is a bug?  I am running 5.1 on Linux-2.4 with one trap2sink defined.  Here is the code that generates the error:

 

#include <unistd.h>

#include <net-snmp/net-snmp-config.h>

#include <net-snmp/net-snmp-includes.h>

#include <net-snmp/library/default_store.h>

#include <net-snmp/agent/net-snmp-agent-includes.h>

#include <net-snmp/agent/mib_modules.h>

 

int main( int argc, char* argv[] ) {

 

   const char *myAppName = "snmpd";

 

   snmp_enable_stderrlog();

   init_agent( myAppName );

   init_mib_modules();

   init_snmp( myAppName );

   init_master_agent();

   snmp_store( myAppName );

 

   oid snmpTrapOid[]

      = { 1,3,6,1,6,3,1,1,4,1,0 };

 

   oid ourAlertOid[]

      = { 1,3,6,1,4,1,9,9,383,0,1 };

 

   size_t ourAlertOidLength

      = OID_LENGTH( ourAlertOid );

 

   netsnmp_variable_list *myVarsPtr = NULL;

 

   snmp_varlist_add_variable(

      &myVarsPtr,

      snmpTrapOid,

      OID_LENGTH( snmpTrapOid ),

      ASN_OBJECT_ID,

      reinterpret_cast< u_char * >( ourAlertOid ),

      ourAlertOidLength * sizeof( oid ) );

 

   send_v2trap( myVarsPtr );

 

   while( true ) {

      agent_check_and_process( 0 );

      ::usleep( 500 );

   }

 

   return 0;

}

 

My snmpd.conf:

 

sysobjectid 1.3.6.1.4.1.9.9.383

agentaddress udp:161

rocommunity public

rwcommunity private

syslocation Unknown

syscontact Unknown

trapcommunity public

trap2sink 10.89.147.32 public

 

Thanks in advance,

Shane

 

Reply via email to