- ret = snmp_agent_register_oid_index(&td->index_oid, *index,
- snmp_agent_table_index_oid_handler);
- if (ret != 0)
- return ret;
- } else {
- /* instance as a key is required for any table */
- ret = c_avl_insert(td->instance_index, index_oid, NULL);
- if (ret != 0) {
- sfree(index_oid);
- return ret;
+ int keys_processed = 0;
+
+ for (llentry_t *de = llist_head(td->columns); de != NULL; de = de->next) {
+ data_definition_t *idd = de->value;
+ if (!idd->is_index_key)
+ continue;
+
+ for (size_t i = 0; i < idd->oids_len; i++) {
+ if (td->index_oid.oid_len)
+ ret = snmp_agent_register_oid_index(&idd->oids[i], *index,
+ snmp_agent_table_oid_handler);
+ else
+ ret = snmp_agent_register_oid_string(&idd->oids[i], *index_oid,
+ snmp_agent_table_oid_handler);
+
+ if (ret != 0) {
+ ERROR(PLUGIN_NAME ": Could not register OID");
+ return ret;
+ }
+ }
+
+ if (++keys_processed >= td->index_keys_len)
+ break;