I developed my own trap receiver programm called trapd based on snmptrapd.
For now it is only displaying received traps on screen in user friendly way.
So I know this app is working fine.
Now I want this app to send a trap/inform to different destination when
it receives any trap.
For testing purposes I created a function (with help of mib2c).
This function is invoked when my programm receives a trap:
int send_trap(void)
{
netsnmp_variable_list *var_list = NULL;
oid data_oid[] = { 1, 3, 6, 1, 4, 1, 16901, 0, 1 };
oid ShortText_oid[] = { 1, 3, 6, 1, 4, 1, 16901, 4, 0 };
char *data = "testing trap";
u_long uptime = netsnmp_get_agent_uptime();
snmp_varlist_add_variable(&var_list,
snmptrap_oid,
OID_LENGTH(snmptrap_oid),
ASN_OBJECT_ID, (u_char*) data_oid, sizeof(data_oid));
snmp_varlist_add_variable(&var_list,
ShortText_oid,
OID_LENGTH(ShortText_oid), ASN_OCTET_STR, (u_char *)data, strlen(data));
send_v2trap(var_list);
snmp_free_varbind(var_list);
return SNMP_ERR_NOERROR;
}
Whe this func is run and I've this error:
send_trap: no v2 trapOID varbind provided
Could you tell me what's wrong with my function?
By the way: I use net-snmp 5.4 under Linux.
I didn't call init_send_trap() or domething similar.
Anyway: how to set trap destination and port within my trapd or this
send_trap()?
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users