Hi,
 
I'm new in this forum and I have the following problem:
 
My snmptranslate works:

[EMAIL PROTECTED] table]# snmptranslate -On PUCCAMP-CONV-MIB::freeChannelTable
.1.3.6.1.4.1.23955.1.2

When I run snmptable returns no entries, why?:

[EMAIL PROTECTED] table]# snmptable -v 2c -c priv_puccamp localhost PUCCAMP-CONV-MIB::freeChannelTable
PUCCAMP-CONV-MIB::freeChannelTable: No entries

But I can executre snmpget with success:

# snmpget -v 2c -c priv_puccamp 192.168.0.178 freeChannelStatus.21 freeChannelNr.21 freeChannelfree.21
PUCCAMP-CONV-MIB::freeChannelStatus.21 = INTEGER: 0
PUCCAMP-CONV-MIB::freeChannelNr.21 = INTEGER: 22
PUCCAMP-CONV-MIB::freeChannelfree.21 = INTEGER: 1

I'd appreciate any help

Here is my MIB:

freeChannelTable  OBJECT-TYPE
        SYNTAX SEQUENCE OF FreeChannelEntry
        MAX-ACCESS not-accessible
        STATUS     current
        DESCRIPTION
                ""
        ::= { convCompWave 2 }

freeChannelEntry  OBJECT-TYPE
        SYNTAX  FreeChannelEntry
        MAX-ACCESS not-accessible
        STATUS     current
        DESCRIPTION
                ""
        INDEX { freeChannelID1 }
        ::= { freeChannelTable 1 }

FreeChannelEntry ::= SEQUENCE {
        freeChannelID1
                Integer32,
        freeChannelStatus
                Integer32,
        freeChannelNr
                Integer32,
        freeChannelfree
                Integer32
}

freeChannelID1  OBJECT-TYPE
        SYNTAX     Integer32 (1..32)
        MAX-ACCESS read-only
        STATUS     current
        DESCRIPTION
                ""
        ::= { freeChannelEntry 1 }

freeChannelStatus  OBJECT-TYPE
        SYNTAX     Integer32
        MAX-ACCESS read-write
        STATUS     current
        DESCRIPTION
                ""
        ::= { freeChannelEntry 2 }

freeChannelNr  OBJECT-TYPE
        SYNTAX     Integer32
        MAX-ACCESS read-only
        STATUS     current
        DESCRIPTION
                ""
        ::= { freeChannelEntry 3 }

freeChannelfree  OBJECT-TYPE
        SYNTAX     Integer32
        MAX-ACCESS read-write
        STATUS     current
        DESCRIPTION
                ""
        ::= { freeChannelEntry 4 }

And here is the code:

[EMAIL PROTECTED] table]# cat puccamp.c
/*
 * Note: this file originally auto-generated by mib2c using
 *        : mib2c.create-dataset.conf,v 5.4 2004/02/02 19:06:53 rstory Exp $
 */

#include <sys/types.h>
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include <net-snmp/agent/table.h>
#include <net-snmp/agent/table_data.h>
#include <net-snmp/agent/table_dataset.h>
#include "puccamp.h"
#include <stdlib.h> /* adicionado */
#include <strings.h> /* adicionado */

/** Initialize the freeChannelTable table by defining its contents and how it's structured */
void
initialize_table_freeChannelTable(void)
{
    int i , v , x ;
    static oid      freeChannelTable_oid[] =
        { 1, 3, 6, 1, 4, 1, 23955, 1, 2 };
    size_t          freeChannelTable_oid_len =
        OID_LENGTH(freeChannelTable_oid);
    netsnmp_table_data_set *table_set;
    netsnmp_table_row *row; /* adicionado */

    /*
     * create the table structure itself
     */
    table_set = netsnmp_create_table_data_set("freeChannelTable");

    /*
     * comment this out or delete if you don't support creation of new rows
     */
    table_set->allow_creation = 1;

    /***************************************************
     * Adding indexes
     */
    DEBUGMSGTL(("initialize_table_freeChannelTable",
                "adding indexes to table freeChannelTable\n"));
    netsnmp_table_set_add_indexes(table_set, ASN_INTEGER,       /* index: freeChannelID1 */
                                  0);

    DEBUGMSGTL(("initialize_table_freeChannelTable",
                "adding column types to table freeChannelTable\n"));
    netsnmp_table_set_multi_add_default_row(table_set,
                                            COLUMN_FREECHANNELID1,
                                            ASN_INTEGER, 0, NULL, 0,
                                            COLUMN_FREECHANNELSTATUS,
                                            ASN_INTEGER, 1, NULL, 0,
                                            COLUMN_FREECHANNELNR,
                                            ASN_INTEGER, 0, NULL, 0,
                                            COLUMN_FREECHANNELFREE,
                                            ASN_INTEGER, 1, NULL, 0, 0);

    /*
     * registering the table with the master agent
     */
    /*
     * note: if you don't need a subhandler to deal with any aspects
     * of the request, change freeChannelTable_handler to "NULL"
     */
    netsnmp_register_table_data_set(netsnmp_create_handler_registration
                                    ("freeChannelTable",
                                     freeChannelTable_handler,
                                     freeChannelTable_oid,
                                     freeChannelTable_oid_len,
                                     HANDLER_CAN_RWRITE), table_set, NULL);

    /*
     * criando a linha para a tabela e adicionando dados
     */
    row = netsnmp_create_table_data_row();
    /*
     * set the index to the IETF WG name "snmpv3"
     */
    v = 0 ;
    i = 21 ;
    netsnmp_table_row_add_index(row, ASN_INTEGER, &i, sizeof(i));


    /*
     * Adicionando para freeChannelStatus o valor de 0
     *netsnmp_table_row_add_index(row, ASN_INTEGER, index, sizeof(int));
     */
    netsnmp_set_row_column(row, COLUMN_FREECHANNELSTATUS, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELSTATUS, 1);        /* make writable via SETs */

    /*
     * Configurando freeChannelNr na 3 coluna da tabela
     */
    netsnmp_set_row_column(row, COLUMN_FREECHANNELNR, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELNR, 1);


    /*
     * Configurando freeChannelfree na 4 coluna da tabela como canal livre
     */
    netsnmp_set_row_column(row, COLUMN_FREECHANNELFREE, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELFREE, 1);        /* make writable via SETs */

    /*
     * adicionando a linha para a tabela
     */
    netsnmp_table_dataset_add_row(table_set, row);

    /*
     * add the data, for the second row
     */
    x = 22 ;
    for ( x=22 ; x<=HIGH_CHANNEL ; x++ ) {
    i = x ;
    v = 0 ;
    row = netsnmp_create_table_data_row();
    netsnmp_table_row_add_index(row, ASN_INTEGER, &i, sizeof(i));

    netsnmp_set_row_column(row, COLUMN_FREECHANNELSTATUS, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELSTATUS, 1);

    netsnmp_set_row_column(row, COLUMN_FREECHANNELNR, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELNR, 1);

    netsnmp_set_row_column(row, COLUMN_FREECHANNELFREE, ASN_INTEGER, (char*) &v, sizeof(v));
    netsnmp_mark_row_column_writable(row, COLUMN_FREECHANNELFREE, 1);        /* make writable via SETs */
    netsnmp_table_dataset_add_row(table_set, row);
    }

    /*
     * Finally, this actually allows the "add_row" token it the
     * * snmpd.conf file to add rows to this table.
     * * Example snmpd.conf line:
     * *   add_row freeChannelTable eos "Glenn Waters" "Dale Francisco"
     */
    netsnmp_register_auto_data_table(table_set, NULL);
    DEBUGMSGTL(("example_puccamp", "Done initializing.\n"));

}


/** Initializes the puccamp module */
void
init_puccamp(void)
{

    /*
     * here we initialize all the tables we're planning on supporting
     */
    initialize_table_freeChannelTable();
}

/** handles requests for the freeChannelTable table, if anything else needs to be done */
int
freeChannelTable_handler(netsnmp_mib_handler *handler,
                         netsnmp_handler_registration *reginfo,
                         netsnmp_agent_request_info *reqinfo,
                         netsnmp_request_info *requests)
{
    /*
     * perform anything here that you need to do.  The requests have
     * already been processed by the master table_dataset handler, but
     * this gives you chance to act on the request in some other way
     * if need be.
     */
    return SNMP_ERR_NOERROR;
}


--
Carlos Roberto Schimidt

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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