Hi Brian, Thanks for the quick reply. I understand your point, however it will take it's own time if I am going with private enterprise number, controlled by IANA.
But for now, could you help me what mistake I might be doing. I hope it is possible to extend MIB-2 standard interface, I found this example to extend standard MIB-2 interface over internet. Thanks & Regards, Bhashkar On Sat, Nov 9, 2024 at 12:43 AM Atkins, Brian <brian.atk...@netapp.com> wrote: > First, you shouldn’t be adding things to MIB-2, it is standards > controlled. If you want to add a MIB branch, you should do it under the > enterprise branch (1.3.6.1.4.1). You’ll need a private enterprise number, > which are controlled by the IANA: > https://www.iana.org/assignments/enterprise-numbers/ > > > > You might be able to use the experimental branch ( > http://oid-info.com/get/1.3.6.1.3). I’m not sure what’s involved in > avoiding collisions on that branch. > > > > There might be other branches or subbranches that are appropriate that I’m > not aware of. > > > > Regards, > > Brian > > > > *From:* bps tech <bpstec...@gmail.com> > *Sent:* Friday, November 8, 2024 11:50 AM > *To:* net-snmp-users@lists.sourceforge.net > *Subject:* netsnmp_register_table_iterator() failing > > > > You don't often get email from bpstec...@gmail.com. Learn why this is > important <https://aka.ms/LearnAboutSenderIdentification> > > > > *EXTERNAL EMAIL - USE CAUTION when clicking links or attachments * > > > > Hi, > > > > I am writing my first code for SNMP. I am trying to extend the MIB-2 > standard interface table. During this process table iterator registration > function netsnmp_register_table_iterator(reg, iinfo) is failing. > > > > Here is my code: > > > > void init_myCustomIfTable(void) { > > static oid ifTable_oid[] = {1, 3, 6, 1, 2, 1, 2, 99}; // Base OID for > custom table extension > > size_t ifTable_oid_len = OID_LENGTH(ifTable_oid); > > > > netsnmp_handler_registration *reg; > > netsnmp_table_registration_info *table_info; > > netsnmp_iterator_info *iinfo; > > > > AIM_LOG_INFO("init_myCustomIfTable \n"); > > // Register the table with the SNMP agent > > reg = netsnmp_create_handler_registration("myCustomIfTable", > > get_custom_metric_data, > ifTable_oid, > > ifTable_oid_len, > > HANDLER_CAN_RONLY); > > > > // Error checking for handler registration > > if (!reg) { > > > > AIM_LOG_INFO("Failed to create handler registration for > myCustomIfTable \n"); > > return; > > } > > > > // Define table structure and columns (e.g., index for ifIndex and > custom metrics) > > table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info); > > if (!table_info) { > > AIM_LOG_INFO("Failed to allocate memory for table registration > info \n"); > > return; > > } > > > > netsnmp_table_helper_add_index(table_info, ASN_INTEGER, 0); // Index > for ifIndex > > table_info->min_column = COLUMN_CUSTOM_METRIC1; // Starting > column for custom data > > table_info->max_column = COLUMN_CUSTOM_METRIC2; // Ending > column for custom data > > > > // Define iterator information for table walking > > iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info); > > if (!iinfo) { > > AIM_LOG_INFO("Failed to allocate memory for iterator info \n"); > > free(table_info); // Free memory before returning > > return; > > } > > iinfo->get_first_data_point = get_first_data_point; > > iinfo->get_next_data_point = get_next_data_point; > > iinfo->table_reginfo = table_info; > > > > // Register the table iterator handler > > if (!netsnmp_register_table_iterator(reg, iinfo)) { > > AIM_LOG_INFO("Failed to register table iterator handler for > myCustomIfTable \n"); > > free(iinfo); // Clean up allocated memory > > free(table_info); // Clean up allocated memory > > return; > > } > > I am attaching my MIB file also. > > > > Any help in this regard would be highly appreciated. > > > > Thanks & Regards, > > Bhashkar >
_______________________________________________ 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