Ok, this is a follow-up to my previous question ("Can't get snmptrapd to
see my traps"), posted a few days ago. I'm trying to use send_v2trap in
my AgentX trap daemon, and so far have been unable to get it to work (I
know that my agent is calling the API, but no trap is being sent out). I
can send the same trap to all destinations using snmptrap on the command
line and I even modified a version of my agent to exec snmptrap with the
trap and a specific IP target, and the trap gets sent as expected.

I recompiled snmpd to include the example/notification trap, and it's
working (that version of snmpd is running on one system, and a listener
on another system is getting the 30-second heartbeat trap). But again,
my traps generated under the rebuilt snmp are not being sent out. I'm
running with the "traps" debug token, and I don't see anything logged in
/var/log/snmpd.log when my agent is calling send_v2trap.

I have a pretty straight-forward trap defined:

-- top level structure
--
pvt3SysMibRev           OBJECT IDENTIFIER ::= { pvt3System 1 }
pvt3SysDatabank         OBJECT IDENTIFIER ::= { pvt3System 2 }
pvt3SysTraps            OBJECT IDENTIFIER ::= { pvt3System 3 }

    pvt3DatabankStateDegraded NOTIFICATION-TYPE
        OBJECTS { name }  
        STATUS  current
        DESCRIPTION "This trap is sent when a databank's state has
                     changed to DEGRADED."
        ::= { pvt3SysTraps 1 }

The OID for this trap is .1.3.6.1.4.1.25148.1.3.1. I'm assuming that
this is what is known as an "enterprise" trap - are they handled
differently from the "built in" traps?  Do I need to configure and
re-build snmpd with one of the "enterprise-oid" options to have my trap
sent out by the send_v2trap API call? I don't quite understand the
difference between the default snmpd traps (such as cold start) and my
traps. 

Here's a code snippet from my agent for the trap above (generated with
mib2c):

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

const char * databankName = "thedegradedsystem"; // hardcoded for demo

int send_pvt3DatabankStateDegraded_trap(void)
{
    netsnmp_variable_list *var_list = NULL;
    oid             pvt3DatabankStateDegraded_oid[] =
        { 1, 3, 6, 1, 4, 1, 25148, 1, 3, 1 };
    oid             name_oid[] = { 1, 3, 6, 1, 4, 1, 25148, 1, 2, 1, 0
};

    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
                              snmptrap_oid, OID_LENGTH(snmptrap_oid),
                              ASN_OBJECT_ID,
                              (u_char *)pvt3DatabankStateDegraded_oid,
                              sizeof(pvt3DatabankStateDegraded_oid));

    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
                              name_oid, OID_LENGTH(name_oid),
                              ASN_OCTET_STR,
                              (u_char *)databankName, 
                              strlen(databankName));
    /*
     * Send the trap to the list of configured destinations
     *  and clean up
     */

    // I see this debug message from my agent
    DEBUGMSGTL(("p3traps", "CALLING SEND_V2TRAP NOW\n"));
    send_v2trap(var_list);
    snmp_free_varbind(var_list);

    return SNMP_ERR_NOERROR;
}

Maybe I'm just not seeing the obvious, either in my code or in my MIB,
but I don't understand why my trap isn't being sent. Any assistance will
be greatly appreciated!
 
~ wendy

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to