I've written a MIB and used mib2c to generate the c template.After
modify,configure,make,make install,I ran the command: “snmpwalk -m ALL -c
public -v2c localhost sysConfigMib” ,and got
SYS-CONFIG-MIB::sysConfigMib = No more variables left in this MIB View (It is
past the end of the MIB tree)
But I wish there should be 2 items below this oid.Where is my fault?The code is
below:
void
init_sysConfigMib(void)
{
netsnmp_table_data_set *table_set;
netsnmp_table_row *row;
oid my_registration_oid[] = { 1, 3, 6, 1, 4, 1, 9953, 0 };
DEBUGMSGTL(("example_data_set", "Initalizing example dataset table\n"));
table_set = netsnmp_create_table_data_set("sysConfigMib");
table_set->allow_creation = 1;
netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
netsnmp_table_set_multi_add_default_row(table_set,
2, ASN_OCTET_STR, 1, NULL, 0,
5, ASN_OCTET_STR, 1, NULL, 0,
0 /* done */ );
netsnmp_register_table_data_set(netsnmp_create_handler_registration
("sysConfigMib", NULL,
my_registration_oid,
OID_LENGTH(my_registration_oid),
HANDLER_CAN_RWRITE), table_set, NULL);
row = netsnmp_create_table_data_row();
netsnmp_table_row_add_index(row, ASN_OCTET_STR, "PotManager",
strlen("PotManager"));
netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "linux", strlen("linux"));
netsnmp_mark_row_column_writable(row, 2, 1); /* make writable via
SETs */
netsnmp_set_row_column(row, 5, ASN_OCTET_STR,
"10.10.10.10/255.255.255.0/10.10.10.1/202.98.160.68",
strlen("10.10.10.10/255.255.255.0/10.10.10.1/56.4.4.1"));
netsnmp_mark_row_column_writable(row, 3, 1); /* make writable via
SETs */
netsnmp_table_dataset_add_row(table_set, row);
netsnmp_register_auto_data_table(table_set, NULL);
DEBUGMSGTL(("example_data_set", "Done initializing.\n"));
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders