[SNMP4J] Filling a shared table with two index columns from several processes not working

Frank Fock fock at agentpp.com
Fri Mar 2 09:20:33 CET 2012


Hello Christian,

You are facing the same issue as described in
http://lists.agentpp.org/pipermail/snmp4j/2012-March/004789.html

I understand that this situation is not covered userfriendly
by SNMP4J-AgentX as implementing a subclass is not straight
forward.

I will provide such a subclass of AgentXSharedMOTableSupport for
multi variable indexes and master/child tables within the next few
days.

With the NET-SNMP master agent, there might be another problem.
In the past the index allocation of the master agent was buggy.
Probably, the NET-SNMP master only allocates the first sub-index
and does not use the whole index as key. Wiht the proposed solution
in
http://lists.agentpp.org/pipermail/snmp4j/2012-March/004789.html
for "child" tables, you can work-around the problem.

Best regards,
Frank

Am 02.03.2012 08:26, schrieb HAAS Christian:
> 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.
>
>
>
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- 
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax:   +49 7024 8688231




More information about the SNMP4J mailing list