Hello,
We are using netsnmp release 5.4.1. We are facing issue with trap sending
We are sending trap at a fast rate 1000 Alarms/sec. The Agent hangs. Adding
some debug statement , we found that the code hangs when we give call to
send_v2trap(var_list);
At our trap receiver we received 500 Alarms and then we saw no traps (as agent
which was forwarding traps was hanged) . Could you suggest what is the issue.
Following is the configuration in snmpd.conf for sending trap:
trapsess -e <engine Id> -v 3 -u <user> -a MD5 -A <password> -l authNoPriv <ip
Address>:<port>
Following is the code used for sending trap:
<<Code>>
int
send_alarmChanged_trap(struct alarmdata trapData)
{
netsnmp_variable_list *var_list = NULL;
oid alarmChanged_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 3, 6 };
oid currentAlarmIndex_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 1
/* insert index here */ };
oid currentAlarmNotificationID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 2
/* insert index here */ };
oid currentAlarmID_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 3
/* insert index here */ };
oid currentAlarmEventType_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 4
/* insert index here */ };
oid currentAlarmSeverity_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 5
/* insert index here */ };
oid currentAlarmReportingElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 6
/* insert index here */ };
oid currentAlarmFaultElement_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 7
/* insert index here */ };
oid currentAlarmName_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 8
/* insert index here */ };
oid currentAlarmProbableCause_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 9
/* insert index here */ };
oid currentAlarmAdditionalInformation_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 10
/* insert index here */ };
oid currentAlarmChangedTime_oid[] =
{ 1, 3, 6, 1, 4, 1, 303, 3, 3, 9, 36, 3, 3, 2, 2, 1, 12
/* insert index here */ };
oid ipAddress_oid[] = {1, 3, 6, 1, 6, 3, 18, 1, 3 };
char ip_address_buffer[128];
struct sockaddr_in my_addr;
OSSAgentConfiguration::getAgentAddress(ip_address_buffer);
inet_aton(ip_address_buffer, &(my_addr.sin_addr));
/*
* Set the snmpTrapOid.0 value
*/
snmp_varlist_add_variable(&var_list,
snmptrap_oid, OID_LENGTH(snmptrap_oid),
ASN_OBJECT_ID,
(const u_char *)&alarmChanged_oid,
sizeof(alarmChanged_oid));
/*
* Add any objects from the trap definition
*/
snmp_varlist_add_variable(&var_list,
currentAlarmIndex_oid,
OID_LENGTH(currentAlarmIndex_oid),
ASN_INTEGER,
(const u_char *)&trapData.alarmIndex,
sizeof(trapData.alarmIndex));
snmp_varlist_add_variable(&var_list,
currentAlarmNotificationID_oid,
OID_LENGTH(currentAlarmNotificationID_oid),
ASN_INTEGER,
(const u_char *)&trapData.alarmNotificationId,
sizeof(trapData.alarmNotificationId));
snmp_varlist_add_variable(&var_list,
currentAlarmID_oid,
OID_LENGTH(currentAlarmID_oid), ASN_INTEGER,
(const u_char *)&trapData.alarmId,
sizeof(trapData.alarmId));
snmp_varlist_add_variable(&var_list,
currentAlarmEventType_oid,
OID_LENGTH(currentAlarmEventType_oid),
ASN_INTEGER,
(const u_char *)&trapData.alarmEventType,
sizeof(trapData.alarmEventType));
snmp_varlist_add_variable(&var_list,
currentAlarmSeverity_oid,
OID_LENGTH(currentAlarmSeverity_oid),
ASN_INTEGER,
(const u_char *)&trapData.alarmSeverity,
sizeof(trapData.alarmSeverity));
snmp_varlist_add_variable(&var_list,
currentAlarmReportingElement_oid,
OID_LENGTH(currentAlarmReportingElement_oid),
ASN_OCTET_STR,
(const u_char *)alarmReportingElement,
strlen(alarmReportingElement));
snmp_varlist_add_variable(&var_list,
currentAlarmFaultElement_oid,
OID_LENGTH(currentAlarmFaultElement_oid),
ASN_OCTET_STR,
(const u_char *)alarmFaultElement,
strlen(alarmFaultElement));
snmp_varlist_add_variable(&var_list,
currentAlarmName_oid,
OID_LENGTH(currentAlarmName_oid),
ASN_OCTET_STR,
(const u_char *)alarmName, strlen(alarmName));
snmp_varlist_add_variable(&var_list,
currentAlarmProbableCause_oid,
OID_LENGTH(currentAlarmProbableCause_oid),
ASN_OCTET_STR,
(const u_char *)alarmProbableCause,
strlen(alarmProbableCause));
snmp_varlist_add_variable(&var_list,
currentAlarmAdditionalInformation_oid,
OID_LENGTH
(currentAlarmAdditionalInformation_oid),
ASN_OCTET_STR,
(const u_char *)alarmAdditionalInformation,
strlen(alarmAdditionalInformation));
snmp_varlist_add_variable(&var_list,
currentAlarmChangedTime_oid,
OID_LENGTH(currentAlarmChangedTime_oid),
ASN_OCTET_STR,
(const u_char *)alarmChangedTime,
strlen(alarmChangedTime));
/*
* Add any extra (optional) objects here
*/
snmp_varlist_add_variable(&var_list,
ipAddress_oid,
OID_LENGTH(ipAddress_oid),
ASN_IPADDRESS,
(const u_char *)&my_addr.sin_addr.s_addr,
sizeof(my_addr.sin_addr.s_addr));
/*
* Send the trap to the list of configured destinations
* and clean up
*/
send_v2trap(var_list); --------- THE CODE HANGS HERE
snmp_free_varbind(var_list);
return SNMP_ERR_NOERROR;
}
<<Code>>
Some help will really help us a lot.
Thanks in Advance.
Br
Gaurav
--
Click for exclusive coverage on the New Bajaj Pulsar 220 the fastest Indian bike
http://www.zigwheels.com/Features/Bajaj-Pulsar-220-DTSi-Special-Coverage/Pulsar_20090623-1-1
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders