Hi!

            I have generated SNMP trap code using mib2c.notify.conf
file. Generated code compiled perfectly and executing perfectly but it
is not sending trap I don't

Understood why?. I have shown sample code below, please go thru it and
help me out where I'm doing wrong.



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

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

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

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

#include "Trap.h"



int

send_ampTempHighMark_trap (size_t ampTempHighVal)

{

        netsnmp_variable_list *var_list = NULL;



        Oid     ampTempHighMarkTrap_oid [] = {1, 3, 6, 1, 4, 1, 13995,
4, 5};

        Oid     ampTempHighMark_oid []     = {1, 3, 6, 1, 4, 1, 13995,
2, 1, 1, 0};



                snmp_varlist_add_variable (&var_list,

                                snmptrap_oid, OID_LENGTH (snmptrap_oid),

                                ASN_OBJECT_ID,

                                (u_char *) ampTempHighMarkTrap_oid,

                                sizeof (ampTempHighMarkTrap_oid) );



                snmp_varlist_add_variable (&var_list,

                                ampTempHighMark_oid, OID_LENGTH
(ampTempHighMark_oid),

                                ASN_INTEGER, (u_char *) &ampTempHighVal,

                                sizeof (ampTempHighVal) );

                /* Send the trap to the list of configured destinations

                 * and clean up

                 */

                send_v2trap (var_list);

               snmp_free_varbind (var_list);

              return SNMP_ERR_NOERROR;

}





main ()

{

        int tempVal = 50;

        init_traps ();

        While (1)

        {

#ifndef DISABLE_TEMPHIGMARK_TRAP

                if( tempVal > THRESHOLD_VALUE )

                {

                        send_ampTempHighMark_trap( tempVal );

                        tempVal = 50;

                }

#endif

}



            I just won't know How SNMP trap will be sent and how he will
get the manager ipAddress and port no before sending a trap.

When I restart the agent I'm receiving the trap because I have written
my IPAddress in /etc/snmp/snmpd.conf file. How this is working.



I guess I'm missing out some points. Please any body implemented traps
or anybody faced the same problem please help me out. 







       With Regards,

G. Siva Prakash Reddy.









This email message and its attachments may contain CONFIDENTIAL AND PRIVILEGED 
INFORMATION intended for the sole use of the addressee(s). If you have received 
it in error, please contact the sender by return email, notify your system 
manager and destroy the original message and any copies thereof. Any review, 
use, disclosure or distribution is unlawful. Please check this email and any 
attachments for the presence of viruses. The Company accepts no  liability for 
any damage caused by any virus transmitted by this email. The views or opinions 
presented in this e-mail are solely those of the author and do not necessarily 
represent those of the company.
The Company reserves the right to monitor, review and store the content of all 
messages sent to or from this e-mail address.

www.aztecsoft.com
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to