[SNMP4J] Filling a shared table with two index columns from several processes not working
HAAS Christian
Christian.Haas at frequentis.com
Fri Mar 2 08:26:21 CET 2012
Hello there!
I have one of those "Hardly an understanding of the underlying system, but have to make it work" cases and I hope to find the right pointers here.
Setup and Goal:
We are using SNMP4J together with Net-SNMP for our processes. On a host with Net-SNMP, we have several of our processes running and each of them shall report some internal statistics (e.g. amount of threads) into a shared table.
This table has an index consisting of two columns: The unique process (component) ID and the statistics (entry) ID.
The idea is to access such a statistics row by using an OID table.componentId.entryId
Several of the entry IDs are reported by more than one process, some are reported by only a selected few - still, each in his own row though. All rows of ones own componentId are handled by the respective process.
For example:
table.componentA.numberOfThreads = ...
table.componentA.packetsReceived = ...
table.componentB.numberOfThreads = ...
table.componentB.packetsReceved = ...
table.componentB.numberOfSessions = ...
The Problem(s):
Filling in the expected values for the index data, each process can add at most one row. (Typically, only one row would show up as for second problem)
Filling a unique 'counter' value into the componentId lets the processes add specific entries only once (e.g. only one is to report numberOfThreads; The first process to register reports all his entries, any further reports only those entryIds not yet used)
Filling unique counters for both index fields, all processes can add all data.
But the second two are probably not what is expected when reading the MIB.
The intent is to use the indexDef as a combined primary key, but as it appears, the two are handled being primary keys each on their own.
MIB:
-- 1.3.6.1.4.1.3043.6.7.2.52
frqChNvpTable OBJECT-TYPE
SYNTAX SEQUENCE OF FrqChNvpEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Name-value-pairs"
::= { frqComponentHealthObjects 52 }
-- 1.3.6.1.4.1.3043.6.7.2.52.1
frqChNvpEntry OBJECT-TYPE
SYNTAX FrqChNvpEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Name-value-pair"
INDEX { chNvpComponentId, chNvpEntryId }
::= { frqChNvpTable 1 }
FrqChNvpEntry ::=
SEQUENCE {
chNvpComponentId
INTEGER,
chNvpComponentName
DisplayString,
chNvpEntryId
INTEGER,
chNvpEntryName
DisplayString,
chNvpEntryLongName
DisplayString,
chNvpEntryValueType
INTEGER,
chNvpEntryValueInt
Integer32,
chNvpEntryValueString
OCTET STRING
}
Code:
In code, a DefaultAgentXSharedMOTable is used, with the indexDef set up hopefully right:
{ // setup combined index
/** Sub indexes (SNMP)*/
final MOTableSubIndex[] subIndexes = new MOTableSubIndex[2];
subIndexes[0] =
new MOTableSubIndex( new OID( MOTableBuilder.OID_CH_NVP_TABLE )
.append( MOTableBuilder.MO_COLUMN_IDX_CH_NVP_COMPONENT_ID ),
SMIConstants.SYNTAX_INTEGER, 1, 1 );
subIndexes[1] =
new MOTableSubIndex( new OID( MOTableBuilder.OID_CH_NVP_TABLE )
.append( MOTableBuilder.MO_COLUMN_IDX_CH_NVP_ENTRY_ID ),
SMIConstants.SYNTAX_INTEGER, 1, 1 );
this.indexDef = new MOTableIndex( subIndexes );
}
Questions:
1. Is the basic goal possible at all? If not, I can save some problem finding and we need to go back to the drawing board.
2. If possible, what am I doing wrong in the code? How should I do it?
3. Is there anything more I should provide so I can help you help me help us all? :)
4. Side question: What are the two last parameters of the MOTableSubIndex constructor for? It works only using 1, 1.
I realize just days ago there seems like to have been a similar problem with a combined index on this list, but I can't see whether this is the same problem nor did I understand the proposed solution.
Thank you and kind regards,
ch
____________________________________________________
Christian Haas
Software Engineer
FREQUENTIS AG
Innovationsstraße 1, 1100 Vienna, Austria
Phone +43-1-811 50 - 8353
Mobile +43-664-60 850 - 8353
Fax +43-1-811 50 - 77 8353
Web www.frequentis.com
E-Mail christian.haas at frequentis.com<mailto:christian.haas at frequentis.com>
Handelsgericht Wien (Vienna Commercial Court): FN 72115 b
DVR 0364797, ATU 14715600
____________________________________________________
Diese E-Mail könnte vertrauliche und/oder rechtlich geschützte Informationen enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail sind nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
More information about the SNMP4J
mailing list