In below code I m using net-snmp subagent method to start the process.

But when I am trying to call any other function  inside
send_highCpuUsage_trap()  it is returning me garbage value !!! can Yyou tell
me what is the reason behind it ? and how can i call another function inside
this function ??

The function is working only if i call it inside   "init" function only !!!

 

Thank s in advance.

 

 

void

init_ionline(void)

{

 

cpu(highCpuUsage);

 

}

 

void cpu(int highCpuUsage)

 {

     int *highCpuUsage1;

     highCpuUsage1=&highCpuUsage;

 

     DEBUGMSGTL(("example_notification",

                 "initializing (setting callback alarm)\n"));

     

     snmp_alarm_register(30,     /* seconds */

                         SA_REPEAT,      /* repeat (every 30 seconds). */

                        send_highCpuUsage_trap,      /* our callback */

                           *highCpuUsage1  /* no callback data needed */

         );

}

 

void

send_highCpuUsage_trap(unsigned int clientreg, void *highCpuUsage1)

{

    netsnmp_variable_list  *var_list = NULL;

    oid highCpuUsage_oid[] = { 1,3,6,1,4,1,21067,3,1,4,1 };

   oid snmptrap_oid[]={ 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };

 

  int highCpuUsage=30;

    /*

     * Set the snmpTrapOid.0 value

     */

     size_t highCpuUsage_oid_len=OID_LENGTH(highCpuUsage_oid);

     

 

    snmp_varlist_add_variable(&var_list,

        snmptrap_oid, OID_LENGTH(snmptrap_oid),

        ASN_INTEGER,

        (u_char *)&highCpuUsage, sizeof(highCpuUsage));

    

 

    /*

     * Add any extra (optional) objects here

     */

 

    /*

     * Send the trap to the list of configured destinations

     *  and clean up

     */

   send_v2trap( var_list );

    snmp_free_varbind( var_list );

 

}

 

 

 

 

 

 

 

 

 

 

 

 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to