Hello Friends,
I am using netsnmp 5.1.2 , i have written a code that will send trap
to main agent i.e. snmpd, for this i have return a module that have
follwing function i.e.

1 ) initialize()
       doing snmp initalization in this function i.e
       snmp_disable_log();
       if (netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
                                                NETSNMP_DS_AGENT_ROLE, 1) != 0)
                     return ERROR;
        // for this i also modified snmpd.conf so that main agent
        // listen on correct port
       if (netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
             NETSNMP_DS_AGENT_X_SOCKET, "udp:localhost:705") !=0 )
                 return ERR_NETSNMP;
         while(i< 4) {
                ret_val = init_agent("subagent");
                if(ret_val == 0)
                        break;
                sleep(2);
                i++;
        }
        if(ret_val != 0)
                return ERR_NETSNMP;
        init_snmp("subagent");

2) trap_send
     send trap to main  agent i.e. snmpd
      using following api
      snmp_varlist_add_variable
      sendv2_trap
      snmp_free_varbind
3) destroy
     snmp_shutdown("sub-agent");
     shutdown_agent();


       so my main program call this function when it starts  i.e.
       when it starts it call initialize then for sending trap it call
       trap_send function. when main program dont want to send trap
       it call destroy &
       problem occurs when main program want to send
       trap again then it again call initalization function & when it call
       initialization funcion it fails in init_agent function it fails
i.e it exit
       so my main from get exited.
       what may be the problem I have seen simmilar post on mailing
       list of netsnmp but don't get help from thouse mails.
       I think when main program call destroy, & after that call init_agent
       then at that time some thing went wrong i also don't know weather
       i correct or not. Please help me in this friends
       Thanks in Advance
       Bhushan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to