In my Mib2c generated C code I am getting some data from system...I am Usinf
for(;;) in "handle" function for updating data..but it is called only after
GET or WALK requests fired. What I need is a can call a function continually
which is returning a INT value between 1-100...and When the value goes above
90 it should call below  cpuUsageTrap() function for generating TRAP.

 

In short how can I trigger a trap function ???

 

Please help me with this..

Thanks in advance.

 

void cpuUsageTrap()

{

      DEBUGMSGTL(("example_notification","initializing (setting callback
alarm)\n"));

      snmp_alarm_register(    10,SA_REPEAT,send_highCpuUsage_trap,NULL);

}

 

void send_highCpuUsage_trap(unsigned int clientreg, void *clientarg) {

 

      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 };

 

      snmp_varlist_add_variable(&var_list,snmptrap_oid,
OID_LENGTH(snmptrap_oid),

                        ASN_OBJECT_ID,(u_char *)&highCpuUsage_oid,
sizeof(highCpuUsage_oid));

 

      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