Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2012
    Athens, Greece

    SNMP Table - Index value is "?"


    I wonder if anyone knows what the result of my problem means..
    I have designed and created a MIB of my own. It is fairly simple and consists of two tables and two scalar OIDs.

    I've written the Subagent, tested it and it seems to be working correctly.
    There is one problem, though, that I do not even know why it occures.

    I've told my Subagent to add two rows after registering the first Table, so that I could have some values to play with.
    The code looks like this:

    netsnmp_table_row *row;
    row = netsnmp_create_table_data_row();

    //Adding the Index (it's the first column of my table)
    int idx = 1;
    netsnmp_table_row_add_index(row, ASN_INTEGER, &idx, sizeof(idx));

    int a1=112;
    int a2=113;

    //Adding the second column
    netsnmp_set_row_column(row, 2, ASN_INTEGER, &a2, sizeof(a2));
    netsnmp_mark_row_column_writable(row, 2, 1);

    //Adding the third column
    netsnmp_set_row_column(row, 3, ASN_INTEGER, &a3, sizeof(a3));
    netsnmp_mark_row_column_writable(row, 3, 1);

    //Adding the whole row and registering the table
    netsnmp_table_dataset_add_row(table_set, row);
    netsnmp_register_auto_data_table(table_set, NULL);

    The above seems to be working just fine, yet one thing is trying to piss me off. If i run a "snmptable" this is my output:


    As you can see, although the myTableIndex is set as "read-write" in the MIB definition, and the Agent runs with no errors, the index itself does not want to take the value i'm giving it and always shows a "?".

    Am I doing something wrong? Does anybody know how could I make the Index take the value i'm giving it?

  2. #2
    Just Joined!
    Join Date
    Feb 2012
    Athens, Greece
    So. This is the 3rd of 3 threads that I've started and found the answer myself.
    I'm starting to feel like a crazy person.

    In order to view the value of your Index, call the snmptable command with the "-Ci" flag. Example :
    snmptable -v 2c -c public localhost -Ci myTable

    Problem, arised from a poor manual reading, solved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts