hi

I installed Net-snmp in my linux rh9 machine.

after installing and configuring the AGENT.

I started the agent daemon using

snmpd -f -Le

i get this error and then the Agent starts

snmpd: send_trap: Timeout
NET-SNMP version 5.2.1.rc3

I am also trying to send a trap using the following program but the
trap is not seen in the SNMPTRAPD daeman.

pls Help.

-----------------------------------------------------------------------------------------------

/*
 * 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 "projTrapMod.h"

static oid snmptrap_oid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };

int
send_trapRecord_trap(void)
{
    netsnmp_variable_list *var_list = NULL;
    oid trapRecord_oid[]        = { 1, 3, 6, 1, 4, 1, 7778, 1, 2 };
    oid description_oid[]       = { 1, 3, 6, 1, 4, 1, 7778, 1, 1, 4, 0 };
    oid processName_oid[]       = { 1, 3, 6, 1, 4, 1, 7778, 1, 1, 1, 0 };
    oid severity_oid[]          = { 1, 3, 6, 1, 4, 1, 7778, 1, 1, 3, 0 };
    oid timeOfOccurence_oid[]   = { 1, 3, 6, 1, 4, 1, 7778, 1, 1, 2, 0 };

    /*
     * Set the snmpTrapOid.0 value
     */

        char *proc_name = "Process11";
        char *desc_text = "Process desc";
        char *time_a = "12:0:17";
        int seve=1;
        

    snmp_varlist_add_variable(&var_list,
                              snmptrap_oid, OID_LENGTH(snmptrap_oid),
                              ASN_OBJECT_ID,
                              trapRecord_oid, sizeof(trapRecord_oid));

    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
                              description_oid, OID_LENGTH(description_oid),
                              ASN_OCTET_STR,
                              (u_char *)&desc_text,strlen(desc_text));

    snmp_varlist_add_variable(&var_list,
                              processName_oid, OID_LENGTH(processName_oid),
                              ASN_OCTET_STR,
                              (u_char *)&proc_name,strlen(proc_name));

    snmp_varlist_add_variable(&var_list,
                              severity_oid, OID_LENGTH(severity_oid),
                              ASN_INTEGER,
                              (u_char *)&seve,sizeof(seve));

    snmp_varlist_add_variable(&var_list,
                              timeOfOccurence_oid,
                              OID_LENGTH(timeOfOccurence_oid),
                              ASN_OCTET_STR,
                              (u_char *)&time_a,strlen(time_a));

    /*
     * Add any extra (optional) objects here
     */

    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */
    send_v2trap(var_list);
    snmp_free_varbind(var_list);

    return SNMP_ERR_NOERROR;
}
-----------------------------------------------------------------------------------------------------

I tried sending a ping to localhost it works perfect.

Kindly help..

regards,

Asha


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to