[AGENT++] All rows in mib table are deleted when snmpd is restarted

Efrat Lefeber ELefeber at trustwave.com
Mon Dec 17 13:06:51 CET 2012


I found the problem:



I have a mib table with two integer indexes.

When I run two subagents, one which inserts a row to the table with index 1.1 and the other inserts a row to the table with index 1.2, the index registration of the second subagent  fails at the master agent.

I don't understand why the master agent doesn't treat my two indexes as an index combined together. Because both indexes contain 1, the index allocation fails.

This is the way I create the table and the index:



const Agentpp::index_info myindexInfo[2] = {{sNMP_SYNTAX_INT, FALSE, 1, 1}, {sNMP_SYNTAX_INT, FALSE, 1, 1}}; const Agentpp::Oidx myOidx[2] = {"1.3.6.1.4.1.6790.1.1.50.1.1.1","1.3.6.1.4.1.6790.1.1.50.1.1.2"};



const Agentpp::index_info myindexInfo[2] = {{sNMP_SYNTAX_INT, FALSE, 1, 1}, {sNMP_SYNTAX_INT, FALSE, 1, 1}}; const Agentpp::Oidx myOidx[2] = {"1.3.6.1.4.1.6790.1.1.50.1.1.1","1.3.6.1.4.1.6790.1.1.50.1.1.2"};



finjan::SubAgentProxy::TableEntry::TableEntry()

        : Agentpp::AgentXSharedTable("1.3.6.1.4.1.6790.1.1.50.1.1", myindexInfo, 2, myOidx, mib, "") {

        add_col..

}



.........





if (tableEntry->allocate_index(oidxIndex) == false( }

        std::cerr << "ERROR: error allocating index " << oidxIndex.get_printable() << std::endl;

        return 1;

}

Nicolas replied to this problem:

"I saw that when we try to register an index, the subagent check for the unicity of that index. But it check the unicity on each index individually, not on the whole key if there's several index like your case.

And for example if you use the function any_index() from the table class (probably SharedXTable) you'll see that the key is always incremented in this manner for a 2 index key : 1.1, 2.2, 3.3, ...



More information about the AGENTPP mailing list