Re: timeticks in second and send a easy trap

"Tako Chang" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
> > "send_easy_trap" isn't really sufficient for your requirements here.

> > > You should probably look at using 'send_enterprise_trap_vars()'
> > > in order to specify your Enterprise OID value.
> > >
> > > Dave
> > >
> >
> > [MIB]
> > myMibTrap ::= { enterprise 920 }
> >
> > demoTrap       NOTIFICATION-TYPE
> > STATUS         current
> > DESCRIPTION     "Send a message to the manager when the DHCP setting is
> >                              chaged"
> > ::= { myMibTrap 1 }
> > [/MIB]
>
> One suggestion - I'd insert an extra definition between myMibTrap and
> demoTrap:
>
> > myMibTrap  ::= { enterprise 920 }
> > myMibTrap0 ::= { myMibTrap 0 }
> > demoTrap       NOTIFICATION-TYPE  ...
> > ::= { myMibTrap0 1 }
>
> That will keep the SNMPv1<->SNMPv2 translations consistent.
>
>
>
> > int specific = 1;
> > oid  trapOid = { SNMP_OID_ENTERPRISES, 920 };
> > oid flagOid = { PRIVATE_OID_DHCP_FLAG };
> > struct variable_list varList;
>
> > send_enterprise_trap_vars( SNMP_TRAP_ENTERPRISESPECIFIC,
> >     specific, trapOid, sizeof(trapOid), varList);
> >
> > Is the above code right ?
>
> Nearly.
> You need to pass a *pointer* to varList, rather than the struct itself.
>
>
> > and does some useful function to set the variable_list
>
> snmp_set_var_objid()  to set the name
> snmp_set_var_typed_value() or
> snmp_set_var_typed_integer() to set the value
>
> Dave


I follow the steps and pass a pointer to varList instead varList itself.
Make sure that the callback function is triggered while the value is changed
, but

 myMibTrap  ::= { enterprise 920 999}
 myMibTrap0 ::= { myMibTrap 0 }
 demoTrap       NOTIFICATION-TYPE  ...
 ::= { myMibTrap0 1 }

(assume 920 is my organization oid)

#define MY_MIB_TRAP_OID SNMP_OID_ENTERPRISES, 920, 999
#define MY_OID_COMMOM SNMP_OID_ENTERPRISES, 920, 1

cb_func( cfgchange_params_t * cfgchange_params) {
struct variable_list vars;
oid trapoid[] = { MY_OID_TRAP_COMMON };
oid testFlagoid[] = {MY_OID_COMMON, 1, 2 };

memset(&vars, 0, sizeof(struct variable_list));
vars.next_variable = NULL;
snmp_set_var_objid(&vars, stbDhcpMode_oid, OID_LENGTH(stbDhcpMode_oid));
snmp_set_var_value(&vars,(u_char*)cfgchange_params->buffer,
cfgchange_params->bufsize);
vars.type = ASN_INTEGER;
send_enterprise_trap_vars( SNMP_TRAP_ENTERPRISESPECIFIC, 1,
trapoid,OID_LENGTH(trapoid), &vars );
}

the error message pop out to me:
snmpd: send_trap: Error building ASN.1 representation (build int size 5: s/b
4)

I can't make sure what the red parts actually mean.

Jack

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.