Below there are two functions are given for generating traps, I want to pass
an integer argument eg.
"highCpuUsage" .so that I can send value of this variable in a trap.How can
I pass such arguments in below send_highCpuUsage_trap function ?
Thanks in advance,
Jatin.
void cpu()
{
DEBUGMSGTL(("example_notification",
"initializing (setting callback alarm)\n"));
snmp_alarm_register(30, /* seconds */
SA_REPEAT, /* repeat (every 30 seconds). */
send_highCpuUsage_trap, /* our callback */
NULL /* 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