net-snmp에서 심플한 snmptrapv1을 보내기 위해 send_easy_trap을 사용했습니다. 그런데..
1. 환경 : 페도라 11
2. net-snmp-5.3.2 사용
SNMPTrapv1을 보내는데 간단히 Generic Trap의 linkdown(3), linkup(2)의 상태만 보내려고 합니다.
그리하여 net-snmp의 API중에 send_easy_trap을 사용하였습니다.
아래는 send_easy_trap의 사용방법입니다.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
Definition at line 634 of file agent_trap.c.
void send_easy_trap ( int trap,
int specific
)
Sends an SNMPv1 trap (or the SNMPv2 equivalent) to the list of configured trap destinations (or "sinks"), using the provided values for the generic trap type and specific trap value.
This function eventually calls send_enterprise_trap_vars. If the trap type is not set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length paramater is set to the pre defined NETSNMP_SYSTEM_MIB oid and length respectively. If the trap type is set to SNMP_TRAP_ENTERPRISESPECIFIC the enterprise and enterprise_length parameters are set to the pre-defined NETSNMP_NOTIFICATION_MIB oid and length respectively.
Parameters:
trap is the generic trap type.
specific is the specific trap value.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<원문> http://net-snmp.sourceforge.net/dev/agent/group__agent__trap.html
static snmptrap_oid[] = { 1,3,6,1,6,3,1,1,4,1,0}; int send_notiport_trap(int module, int port, int reason, char *notidatetime) { netsnmp_variable_list *var_list = NULL; oid notiport_oid[] = { 1,3,6,1,4,1,5927,1,130,1,0,5}; snmp_varlist_add_variable(&var_list, snmptrap_oid, OID_LENGTH(snmptrap_oid), ASN_OBJECT_ID, (u_char *)notiport_oid, sizeof(notiport_oid)); send_v2trap(var_list); send_easy_trap(reason, 1): snmp_free_varbind(var_list); return SNMP_ERR_NOERROR; }
이렇게 사용하였습니다.
그런데 위의 send_v2trap은 날라오는데
send_easy_trap은 오지 않네요...
이게 웬일 일까요...
뭔가 설정을 안 해 준 것이 있는 것 같은데
사용해 보신 분들의 조언을 구합니다.
댓글 달기