Aaron Young
2009-09-16 20:50:08 UTC
I've experienced an issue with 5.4.2.1 where my table has non-contiguous
column ids, and both snmpwalk and snmptable seem to stop at the gap.
i.e. (column ids 2,3,10)
snmptable -v2c -Ci -c public localhost:1616 mxOtherTable
SNMP table: MPATHIX-MIB::mxOtherTable
index mxOtherIdentity mxOtherState mxOtherErrorMsg
1 Joe's Chicken and Waffles ok ?
2 Sal's donut shoppe ok ?
If I use snmptable in GETNEXT or v1 mode it works fine.
An snmpwalk on the table oid will also stop at the gap:
snmpwalk -v2c -Ci -c public localhost:1616 mxOtherTable
MPATHIX-MIB::mxOtherTable = No Such Object available on this agent at this
OID
MPATHIX-MIB::mxOtherIdentity.1 = STRING: Joe's Chicken and Waffles
MPATHIX-MIB::mxOtherIdentity.2 = STRING: Sal's donut shoppe
MPATHIX-MIB::mxOtherState.1 = INTEGER: ok(1)
MPATHIX-MIB::mxOtherState.2 = INTEGER: ok(1)
This is in Solaris x86 built in 64-bit mode, communicating with snmpd
through agentx
Here's how I built my table:
static oid tableOid[] = { 1, 3, 6, 1, 4, 1, 8276, 1, 2, 1, 6 };
int defaultState = 1;
std::string tableName = "mxOtherTable";
static netsnmp_table_data_set* table
= netsnmp_create_table_data_set( tableName.c_str() );
// disallow SET
table->allow_creation = 0;
// add index
netsnmp_table_dataset_add_index( table, ASN_INTEGER );
// add columns
// column #
// type
// writable
// default value
// default value len
netsnmp_table_set_multi_add_default_row( table,
2, ASN_OCTET_STR, 0, NULL, 0,
3, ASN_INTEGER, 0, &defaultState, sizeof( defaultState ),
20, ASN_OCTET_STR, 0, NULL, 0,
0 );
netsnmp_handler_registration* regInfo
= netsnmp_create_handler_registration
( tableName.c_str(), NULL,
tableOid, OID_LENGTH(tableOid),
HANDLER_CAN_RWRITE );
netsnmp_register_table_data_set( regInfo, table, NULL);
netsnmp_register_auto_data_table( table, NULL );
// add
netsnmp_table_row* newRow = netsnmp_create_table_data_row();
int index = 1;
netsnmp_table_row_add_index( newRow, ASN_INTEGER,
&index, sizeof( index ) );
std::string identity = "Joe's Chicken and Waffles";
netsnmp_set_row_column (newRow, 2, ASN_OCTET_STR,
identity.c_str(), identity.length() );
netsnmp_set_row_column (newRow, 3, ASN_INTEGER,
reinterpret_cast<const char*>(&defaultState), sizeof( defaultState ) );
std::string errorMsg = "Waffle-lite";
netsnmp_set_row_column (newRow, 20, ASN_OCTET_STR,
errorMsg.c_str(), errorMsg.length() );
netsnmp_table_dataset_add_row( table, newRow );
// add
netsnmp_table_row* newRow2 = netsnmp_create_table_data_row();
index++;
netsnmp_table_row_add_index( newRow2, ASN_INTEGER,
&index, sizeof( index ) );
identity = "Sal's donut shoppe";
netsnmp_set_row_column (newRow2, 2, ASN_OCTET_STR,
identity.c_str(), identity.length() );
netsnmp_set_row_column (newRow2, 3, ASN_INTEGER,
reinterpret_cast<const char*>(&defaultState), sizeof( defaultState ) );
errorMsg = "full of donuts";
netsnmp_set_row_column (newRow2, 20, ASN_OCTET_STR,
errorMsg.c_str(), errorMsg.length() );
netsnmp_table_dataset_add_row( table, newRow2 );
Any ideas on what the problem may be?
-Aaron
column ids, and both snmpwalk and snmptable seem to stop at the gap.
i.e. (column ids 2,3,10)
snmptable -v2c -Ci -c public localhost:1616 mxOtherTable
SNMP table: MPATHIX-MIB::mxOtherTable
index mxOtherIdentity mxOtherState mxOtherErrorMsg
1 Joe's Chicken and Waffles ok ?
2 Sal's donut shoppe ok ?
If I use snmptable in GETNEXT or v1 mode it works fine.
An snmpwalk on the table oid will also stop at the gap:
snmpwalk -v2c -Ci -c public localhost:1616 mxOtherTable
MPATHIX-MIB::mxOtherTable = No Such Object available on this agent at this
OID
MPATHIX-MIB::mxOtherIdentity.1 = STRING: Joe's Chicken and Waffles
MPATHIX-MIB::mxOtherIdentity.2 = STRING: Sal's donut shoppe
MPATHIX-MIB::mxOtherState.1 = INTEGER: ok(1)
MPATHIX-MIB::mxOtherState.2 = INTEGER: ok(1)
This is in Solaris x86 built in 64-bit mode, communicating with snmpd
through agentx
Here's how I built my table:
static oid tableOid[] = { 1, 3, 6, 1, 4, 1, 8276, 1, 2, 1, 6 };
int defaultState = 1;
std::string tableName = "mxOtherTable";
static netsnmp_table_data_set* table
= netsnmp_create_table_data_set( tableName.c_str() );
// disallow SET
table->allow_creation = 0;
// add index
netsnmp_table_dataset_add_index( table, ASN_INTEGER );
// add columns
// column #
// type
// writable
// default value
// default value len
netsnmp_table_set_multi_add_default_row( table,
2, ASN_OCTET_STR, 0, NULL, 0,
3, ASN_INTEGER, 0, &defaultState, sizeof( defaultState ),
20, ASN_OCTET_STR, 0, NULL, 0,
0 );
netsnmp_handler_registration* regInfo
= netsnmp_create_handler_registration
( tableName.c_str(), NULL,
tableOid, OID_LENGTH(tableOid),
HANDLER_CAN_RWRITE );
netsnmp_register_table_data_set( regInfo, table, NULL);
netsnmp_register_auto_data_table( table, NULL );
// add
netsnmp_table_row* newRow = netsnmp_create_table_data_row();
int index = 1;
netsnmp_table_row_add_index( newRow, ASN_INTEGER,
&index, sizeof( index ) );
std::string identity = "Joe's Chicken and Waffles";
netsnmp_set_row_column (newRow, 2, ASN_OCTET_STR,
identity.c_str(), identity.length() );
netsnmp_set_row_column (newRow, 3, ASN_INTEGER,
reinterpret_cast<const char*>(&defaultState), sizeof( defaultState ) );
std::string errorMsg = "Waffle-lite";
netsnmp_set_row_column (newRow, 20, ASN_OCTET_STR,
errorMsg.c_str(), errorMsg.length() );
netsnmp_table_dataset_add_row( table, newRow );
// add
netsnmp_table_row* newRow2 = netsnmp_create_table_data_row();
index++;
netsnmp_table_row_add_index( newRow2, ASN_INTEGER,
&index, sizeof( index ) );
identity = "Sal's donut shoppe";
netsnmp_set_row_column (newRow2, 2, ASN_OCTET_STR,
identity.c_str(), identity.length() );
netsnmp_set_row_column (newRow2, 3, ASN_INTEGER,
reinterpret_cast<const char*>(&defaultState), sizeof( defaultState ) );
errorMsg = "full of donuts";
netsnmp_set_row_column (newRow2, 20, ASN_OCTET_STR,
errorMsg.c_str(), errorMsg.length() );
netsnmp_table_dataset_add_row( table, newRow2 );
Any ideas on what the problem may be?
-Aaron