YES
some piece code of mine:
snmp_alarm_register(10, /* seconds */
SA_REPEAT, /* repeat (every 10 seconds). */
send_systemNumbertrap_trap, /* our callback */
NULL /* no callback data needed */
);
int
send_systemNumbertrap_trap( void )
{
netsnmp_variable_list *var_list = NULL;
oid systemNumbertrap_oid[] = { 1,3,6,1,4,1,30901,2090,2091,0,1 };
oid systemNumber_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,1, 0 };
/*
* Set the snmpTrapOid.0 value
*/
snmp_varlist_add_variable(&var_list,
snmptrap_oid, OID_LENGTH(snmptrap_oid),
ASN_OBJECT_ID,
systemNumbertrap_oid, sizeof(systemNumbertrap_oid));
/*
* Add any objects from the trap definition
*/
snmp_varlist_add_variable(&var_list,
systemNumber_oid, OID_LENGTH(systemNumber_oid),
ASN_OCTET_STR,
/* Set an appropriate value for systemNumber */
ucharp, strlen(ucharp));
/*
* 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 );
return SNMP_ERR_NOERROR;
}
is it right,Dave? I am back!:=)Attachments are my config files,put them /usr/local/share/snmp/ Hope it helps! ------------------ Original ------------------ From: "maxim maxim"<[email protected]>; Date: Mon, Mar 8, 2010 00:18 AM To: "Net-snmp-coders"<[email protected]>; Subject: sending trap Hi to all, Whether does exist net-snmp api for sending trap from sub agent, where i can to add a destination ip address and port? like snmp_trap_api, but i won't to work with configuration file. Thanks ------------------------------------------------------------------------------ Download Intel� Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
snmptrapd.conf
Description: Binary data
snmpd.conf
Description: Binary data
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ 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
