------------------ Original ------------------
From:  "Dave Shield"<[email protected]>;
Date:  Mon, Jan 25, 2010 05:30 PM
To:  "Alexander King"<[email protected]>; 
Cc:  "net-snmp-users"<[email protected]>; 
Subject:  Re: when snmpwalk query my private trap OID the snmpd routine auto 
termination

2010/1/25 Alexander King <[email protected]>:
> 1. I define a completed MIB file(included scalars,tables,traps),
> and make it right.

How did you check that the MIB file was "right"?
What validation tools did you use?

Perhaps if you posted the full MIB file,
we might be able to comment.
>>>>I use MG-soft(V2010a) suite software,use the MG-soft MIB compiler tool 
>>>>define the MIB file,when I press 'Compile',if there is error(s), I cannot 
>>>>run through the whole MIB file,if there is error(s),the tool can display 
>>>>where it is.bjectively speaking,I really think it is good.

And I used the smilint checked my MIB file,got many warnings like this:

UIT-NOTIFICATION-MIB.my:69: revision date after last update
UIT-NOTIFICATION-MIB.my:75: revision for last update is missing
UIT-NOTIFICATION-MIB.my:165: warning: index of row `hostInterfaceFCEntry' can 
exceed OID size limit by 144 subidentifier(s)
UIT-NOTIFICATION-MIB.my:278: object `fcPort' of notification `fcPorttrap' must 
not be `not-accessible'
UIT-NOTIFICATION-MIB.my:93: warning: node `uitProductsName' must be contained 
in at least one conformance group
UIT-NOTIFICATION-MIB.my:115: warning: node `systemNumber' must be contained in 
at least one conformance group
UIT-NOTIFICATION-MIB.my:122: warning: node `systemSerialNumber' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:129: warning: node `systemType' must be contained in at 
least one conformance group
UIT-NOTIFICATION-MIB.my:136: warning: node `systemStatus' must be contained in 
at least one conformance group
UIT-NOTIFICATION-MIB.my:146: warning: node `systemJBODNumber' must be contained 
in at least one conformance group
UIT-NOTIFICATION-MIB.my:199: warning: node `fcStatus' must be contained in at 
least one conformance group
UIT-NOTIFICATION-MIB.my:209: warning: node `fcWWN' must be contained in at 
least one conformance group
UIT-NOTIFICATION-MIB.my:216: warning: node `fcSpeed' must be contained in at 
least one conformance group
UIT-NOTIFICATION-MIB.my:223: warning: node `fcTopology' must be contained in at 
least one conformance group
UIT-NOTIFICATION-MIB.my:230: warning: node `fcConnections' must be contained in 
at least one conformance group
UIT-NOTIFICATION-MIB.my:246: warning: notification `systemNumbertrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:252: warning: notification `systemSerialNumbertrap' 
must be contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:258: warning: notification `systemTypetrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:264: warning: notification `systemStatustrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:270: warning: notification `systemJBODNumbertrap' must 
be contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:278: warning: notification `fcPorttrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:284: warning: notification `fcStatustrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:290: warning: notification `fcWWNtrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:296: warning: notification `fcSpeedtrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:302: warning: notification `fcTopologytrap' must be 
contained in at least one conformance group
UIT-NOTIFICATION-MIB.my:308: warning: notification `fcConnectionstrap' must be 
contained in at least one conformance group

> 2.Get the generated code use the
> tools: mib2c.iterate.conf,mib2c.scalar.conf,mib2c.table.conf,
> and modify them

But there isn't a template "mib2c.table.conf" !

>>>>sorry,the "mib2c.iterate.conf",it is input error.sorry!

>  and delete the traps's OIDs

Why?
The code generated by the mib2c template listed above
shouldn't cover the notifications, so there shouldn't be
any mention of the trap OIDs.

>>>>Sorry,I just *donot* want the snmpwalk routine query the snmp trap 
>>>>OIDs,Oh,my God,It is a big mistake.

Assuming you defined the MIBs correctly.

> 3.Delete the traps definitions in the MIB file,and keep all the other
> unchange.especially the structure of the MIB and their OID relationship.

That should not be necessary.

> Am I right?I really think it is wrong.

It certainly sounds as if you are doing something wrong.
Either in your MIB file definitions, or in the code you are
generating.

But unless you show us the full MIB file (*without* deleting
the trap definitions),  tell us *exactly* what mib2c commands
you ran, and show us the complete code that you are
working with - it's almost impossible to say what's wrong.

>>>>I attached the full MIB file by attachment,I know you 'a real (paid) job 
>>>>that needs to take precedence',and I know exactly your warmhearted work for 
>>>>the list.So I donot intend mail you the source code files.

In brief,I got the three generated files,initialized the values,integrated the 
.h files into one,and the .c files too,
in init_uit() funtion something like this:

void
init_uit(void)
{
    static oid uitProductsName_oid[] = { 1,3,6,1,4,1,30901,2090,7000,1 };
    static oid systemNumber_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,1 };
    static oid systemSerialNumber_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,2 
};
    static oid systemType_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,3 };
    static oid systemStatus_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,4 };
    static oid systemJBODNumber_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,5 };

  DEBUGMSGTL(("uit", "Initializing\n"));

    netsnmp_register_scalar(
        netsnmp_create_handler_registration("uitProductsName", 
handle_uitProductsName,
                               uitProductsName_oid, 
OID_LENGTH(uitProductsName_oid),
                               HANDLER_CAN_RONLY
        ));
   /* [SKIP] some scalar register                                     */


    initialize_table_hostInterfaceFCTable();
    
    snmp_alarm_register(10,     /* seconds */
                    SA_REPEAT,      /* repeat (every 10 seconds). */
                    send_systemNumbertrap_trap,      /* our callback */
                    NULL    /* no callback data needed */
                    );

     /* [SKIP] here are some other snmp_alarm_register() function call  */
}

>>>>and one of the trap function in uit.c file like this:

static oid snmptrap_oid[] = {1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0};  
           
int
send_systemNumbertrap_trap( void )
{
    netsnmp_variable_list  *var_list = NULL;
    oid systemNumbertrap_oid[] = { 1,3,6,1,4,1,30901,2090,2091,0,1 };
    oid systemNumber_oid[] = { 1,3,6,1,4,1,30901,2090,7000,2,1,1,1, 0 };

    /*
     * Set the snmpTrapOid.0 value
     */
    snmp_varlist_add_variable(&var_list,
        snmptrap_oid, OID_LENGTH(snmptrap_oid),
        ASN_OBJECT_ID,
        systemNumbertrap_oid, sizeof(systemNumbertrap_oid));
    
    /*
     * Add any objects from the trap definition
     */
    snmp_varlist_add_variable(&var_list,
        systemNumber_oid, OID_LENGTH(systemNumber_oid),
        ASN_OCTET_STR,
        /* Set an appropriate value for systemNumber */
        ucharp, strlen(ucharp));

    /*
     * 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;
}



Dave

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
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

Attachment: UIT-NOTIFICATION-MIB.my
Description: Binary data

Attachment: UIT-NOTIFICATION-MIB.my
Description: Binary data

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
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

Reply via email to