Hi All:
I define the trap entries in the same mib file like this:
controllerInfo OBJECT IDENTIFIER ::= { systeminfoController 1 }
systemNumber OBJECT-TYPE
SYNTAX DisplayString( SIZE( 0..256 ) )
ACCESS read-only
STATUS current
DESCRIPTION
"system Number."
::= { controllerInfo 1 }
fcPort OBJECT-TYPE
SYNTAX DisplayString( SIZE( 0..256 ) )
ACCESS read-only
STATUS current
DESCRIPTION
"fc Port."
::= { hostInterfaceFCEntry 1 }
and then:
systemNumbertrap TRAP-TYPE
ENTERPRISE controllerInfo
VARIABLES { systemNumber }
DESCRIPTION "This is just a demo"
::= 51898
fcPorttrap TRAP-TYPE
ENTERPRISE hostInterfaceFCEntry
VARIABLES { fcPort }
DESCRIPTION "Warning:fc port %d was failed!"
::= 511
is it right?
I used ' mib2c -c mib2c.notify.conf XXX ' generate the trap code,but I just
got send_controllerInfotrap_oid one trap send function,and do I should be have
two send_XXX_oid functions?such as:send_controllerInfotrap_oid and
send_hostInterfaceFCEntrytrap_oid
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.notify.conf 10110 2004-04-15 12:29:19Z dts12 $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "uit.h"
static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};
int
send_controllerInfo#_trap( void )
{
netsnmp_variable_list *var_list = NULL;
oid controllerInfo#_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,0 };
/*
* Set the snmpTrapOid.0 value
*/
snmp_varlist_add_variable(&var_list,
snmptrap_oid, OID_LENGTH(snmptrap_oid),
ASN_OBJECT_ID,
controllerInfo#_oid, sizeof(controllerInfo#_oid));
/*
* 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;
}
would you some warmhearted body mail me a trap prototype(mib and modified .c
files) or some hints and links?
Do you have some constructive suggestions,Dave?Forgive me and my horrible
mails. :=)
Alex
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users