Trap not generating
"Ramachandrappa, Nataraju Karidasarahalli" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <A13FA4B2F7631E4B854D1AAA030784490291806C@bgeexc04.asiapacific.cpqcorp.net> |
Hello Team,
I have generated the code using mib2c mib2c.notify.conf MIBNODE and
made the necessary changes to generated code and complied and executed.
I have updated the Trapd.conf also. But no trap generated please help me
how to solve this problem.
I have given the code below for reference.
Thanks in advance
Thanks
nataraju
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.notify.conf,v 5.3 2004/04/15 12:29:19 dts12 Exp $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "hpSTBMIBEvents.h"
char *macaddress ="00:OD:EB:EF";
char *ipaddress = "15.106.208.48";
char *swversion="ver1.3";
int cpucurrentvalue = 80;
int memorycurrentvalue=90;
static oid snmptrap_oid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
void init_hpSTBMIBEvents(void)
{
snmp_alarm_register(30, /* seconds */
SA_REPEAT, /* repeat (every 30 seconds). */
send_stbCPUThresholdExceeded_trap,
NULL /* no callback data needed */
);
}
int
send_stbCPUThresholdExceeded_trap(void)
{
netsnmp_variable_list *var_list = NULL;
oid stbCPUThresholdExceeded_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 2, 1 };
oid stbMACAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 2, 4, 0 };
oid stbIPAddress_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 4, 3, 0 };
oid stbSoftwareVersion_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 2, 6, 0 };
oid stbCurrentCPUUsage_oid[] =
{ 1, 3, 6, 1, 4, 1, 11, 255, 1, 3, 1, 0 };
/*
* Set the snmpTrapOid.0 value
*/
snmp_varlist_add_variable(&var_list,
snmptrap_oid, OID_LENGTH(snmptrap_oid),
ASN_OBJECT_ID,
stbCPUThresholdExceeded_oid,
snmp_varlist_add_variable(&var_list,
stbMACAddress_oid,
OID_LENGTH(stbMACAddress_oid),
ASN_OCTET_STR,
macaddress,strlen(macaddress));
snmp_varlist_add_variable(&var_list,
stbIPAddress_oid,
OID_LENGTH(stbIPAddress_oid),
ASN_OCTET_STR,
ipaddress,strlen(ipaddress));
snmp_varlist_add_variable(&var_list,
stbSoftwareVersion_oid,
OID_LENGTH(stbSoftwareVersion_oid),
ASN_OCTET_STR,
swversion,strlen(swversion));
snmp_varlist_add_variable(&var_list,
stbCurrentCPUUsage_oid,
OID_LENGTH(stbCurrentCPUUsage_oid),
ASN_INTEGER,
&cpucurrentvalue,sizeof(cpucurrentvalue));
sizeof(stbCPUThresholdExceeded_oid));
send_v2trap(var_list);
snmp_free_varbind(var_list);
return SNMP_ERR_NOERROR;
}
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
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