Hi,

I created a MIB, and tried to allocate values to new OID

You find attached my MIB file, data_set.c and data_set.h.

After that I copied the files  data_set.c and data_set.h in the source
directory of Net-SNMP: net-snmp-5.1.1/agent/mibgroup /

I continued as follows :


# ./configure --with-mib-modules="data_set host"
# make
# sudo make install

after that I started the SNMP agent :

#/etc/init.d/snmpd start


 Then i tried to see if the daemon knows about *new enterprise*, for this
reason i did :

#snmpwalk -v 2c -c private 127.0.0.1 .1.3.6.1.4.1.4890.1.1

which outputs are : SNMPv2-SMI::enterprises.4890.1.1 = No Such Object
available on this agent at this OID

So I guess that snmpd is telling me he can't find anything under this tree,
because nothing has been set yet.

So I tried to set this test variable with snmpset on the shell command :

#snmpset -v 2c -c private 127.0.0.1 .1.3.6.1.4.1.4890.1.1.2.\"mtdcsun0\" i
89

which outputs are :

Error in packet.
Reason: notWritable (That object does not support modification)
Failed object:
SNMPv2-SMI::enterprises.4890.1.23.2.8.109.116.100.99.115.117.110.48

and as root, but with no success

But when I do a snmptranslate, I can see that the MIB is parsed correctly
Would you help me to solve my problem ?

Best regards,
BENSASSI Youssef
Software engineer
PING-TABLE-MIB DEFINITIONS ::= BEGIN

IMPORTS
MODULE-IDENTITY, OBJECT-TYPE, Integer32, Opaque, enterprises  FROM SNMPv2-SMI
    SnmpAdminString                                   FROM SNMP-FRAMEWORK-MIB
    RowStatus, StorageType                            FROM SNMPv2-TC
    InetAddressType, InetAddress                      FROM INET-ADDRESS-MIB
;

xavier MODULE-IDENTITY
    LAST-UPDATED "200202060000Z"
    ORGANIZATION "STMicroelectronics"
    CONTACT-INFO   
    "postal:  Xavier Dumas
     email:    main.ja...@mageos.com"
    DESCRIPTION
   "The XAV Demonstration MIB."
    ::= { enterprises 4890 }

pingTableAvgstore OBJECT-TYPE
    SYNTAX      SEQUENCE OF NetSnmpIETFWGEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
   "Entrée du tableau."
    ::= { xavier 1 }

Double ::= TEXTUAL-CONVENTION
    STATUS      current
    DESCRIPTION
        "Definition du type Double"
    SYNTAX Opaque (SIZE(11))

pingTableAvgEntry OBJECT-TYPE
    SYNTAX      PingTableAvgEntry
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
   "A row describing a given working group"
    INDEX   { pingAvgName }
    ::= {pingTableAvgstore 1 }



PingTableAvgEntry ::= SEQUENCE {
   pingAvgName   OCTET STRING,
   entier   INTEGER,
   entier   INTEGER,
   reels   Double
}

pingAvgName OBJECT-TYPE
    SYNTAX      OCTET STRING (SIZE(1..32))
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION
   "Sous nom de l’index"
    ::= { pingTableAvgEntry 1 }

entier OBJECT-TYPE
    SYNTAX      INTEGER
    MAX-ACCESS  read-create
    STATUS      current
    DESCRIPTION
   "Nom du tableau commencant par l’OID 2"
    ::= { pingTableAvgEntry 2 }

entier OBJECT-TYPE
    SYNTAX      INTEGER
    MAX-ACCESS  read-create
    STATUS      current
    DESCRIPTION
   " Nom du tableau commencant par l’OID 3"
    ::= { pingTableAvgEntry 3 }

reels OBJECT-TYPE
    SYNTAX      Double
    MAX-ACCESS  read-create
    STATUS      current
    DESCRIPTION
   " Nom du tableau commencant par l’OID 4"
    ::= { pingTableAvgEntry 4 }

END
    // Fichiers a inclure
    #include <net-snmp/net-snmp-config.h>
    #include <net-snmp/net-snmp-includes.h>
    #include <net-snmp/agent/net-snmp-agent-includes.h>

    void
    init_data_set(void)
    {
        netsnmp_table_data_set *table_set;
        netsnmp_table_row *row;

    //OID ou sera accessible le tableau
    oid             my_registration_oid[] =
            { 1, 3, 6, 1, 4, 1, 4890, 1 };


    // outils de debugage en cas de problème
    DEBUGMSGTL(("data_set",
                    "Initalizing dataset table\n"));

    table_set = netsnmp_create_table_data_set("pingTableAvgstore");

        //autorise la création d’une nouvelle ligne par snmpset
    table_set->allow_creation = 1;

        //décrit la structure de l’index d’une ligne
    netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);

        //décrit la structure d’une colonne
    netsnmp_table_set_multi_add_default_row(table_set,
    /*
    * colonne 2 = INTEGER,
    * écriture possible = 1,
    * valeur par défaut = NULL,
    * longueur par défaut = 0
    */
    2, ASN_INTEGER, 1, NULL, 0,
    /*
    * même colonne
    */
    3, ASN_INTEGER, 1, NULL, 0,
    /*
    * avec des réels
    */
    4, ASN_OPAQUE_DOUBLE, 1, NULL, 0,
                                         

          0 /* done */ );

    //enregistre le tableau
    netsnmp_register_table_data_set(netsnmp_create_handler_registration
                                        ("pingTableAvgstore", NULL,
                                         my_registration_oid,
                                         OID_LENGTH(my_registration_oid),
                                         HANDLER_CAN_RWRITE), table_set, NULL);

        DEBUGMSGTL(("data_set", "Done initializing.\n"));
    }


#ifndef DATA_SET_H
#define DATA_SET_H



void init_data_set(void);

#endif                          /* DATA_SET_H */
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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