Thanks, it's work now. Can you please to explain me a two outputs in log file?
This my outputs in log file: Apr 7 13:08:31 max snmptrapd[3128]: <UNKNOWN> [UDP: [192.168.168.112]:41119->[192.168.168.6]]: Trap , DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (6333568) 17:35:35.68, SNMPv2-MIB::snmpTrapOID.0 = OID: NET-SNMP-AGENT-MIB::nsNotifyRestart, SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpNotificationPrefix Apr 7 13:08:31 max snmptrapd[3128]: <UNKNOWN> [UDP: [192.168.168.112]:41119->[192.168.168.6]]: Trap , DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (6333568) 17:35:35.68, SNMPv2-MIB::snmpTrapOID.0 = OID: IF-MIB::linkDown, SNMPv2-MIB::snmpTrapEnterprise.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10 why do i have two outputs? How i can to see that trap is in v2( my directive in snmpd.conf is trap2sink ...)? 2010/4/6 Dave Shield <[email protected]>: > On 6 April 2010 18:26, maxim maxim <[email protected]> wrote: >> snmp_varlist_add_variable(¬ification_vars, >> objid_snmptrap, objid_snmptrap_len, > > This parameter is the name of the varbind to be added. > It's inherently of type Object ID, so the size is the > number of subidentifiers: > >> oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; >> size_t objid_snmptrap_len =OID_LENGTH(objid_snmptrap); > > which is exactly what you have. > > However, the final parameter pair: > >> ASN_OBJECT_ID, >> (u_char *)notification_oid, notification_oid_len); > > is the value to be assigned to this varbind. > This can be of any type (integer, string, ObjectID) > so the size is the size of the whole value. > In *bytes*, not subidentifiers. > >> oid notification_oid[] ={1, 3, 6, 1, 6, 3, 1, 1, 5, 3}; >> size_t notification_oid_len =OID_LENGTH(notification_oid); > > You are passing the number of subidentifiers (32-bit values), > but the library is taking this as the number of bytes (8-bit values). > So it's only using the first quarter of the value. > > Try > size_t notification_oid_len = sizeof(notification_oid); > > Dave > ------------------------------------------------------------------------------ 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
