[SNMP4J] Plea for help from an SNMP beginner

Mark Brand markcbrand at googlemail.com
Thu Jul 17 18:53:41 CEST 2008


Right, I see now. the ".0" is kind of like ptr[0] in c++, only of course
noone would put ptr[0], because it is extraneous, as *ptr
would be the same. So if you have a table, you are doing your ptr[0],
ptr[1], ptr[n] by saying table.0, table.1, table.n
All is clear, in that area at least. But I have new troubles:

I think I am now at a point where I am on my own - I have spent all day
trying to make this work, and not really got anywhere.
I seem to be creating the table row fine, and getting the response I would
expect; that the row is inactive (2). Now, I try to set
the row description, which "should" (according to the docs) be enough
information to allow the agent to fill in the row - but I
just recieve an inconsistent value response. Am I correct in thinking that
this means that although the value could be held by
that entry (has correct syntax) the agent does not want to put it there (for
it's own reasons)?

So in my case, it would be that it has searched it's internal database and
been unable to find the name i gave it, so clearly I
cannot set my row to be linked to that name. But, I have checked very
thoroughly the different names that could be taken by
the entry I want, and cannot succeed in finding one which will be accepted.
( exhaustively, almost ) and I think it is unlikely that
the names given in the data files are different to the ones used internally
by the software, so there must be another problem.

Is it possible that the agent would return inconsistent value whilst still
setting the value, say if the row could not yet be finished
since it only had partial data?
To try and clarify:
If to create a row in my table, I need to first set the status column, and
then set two entries, A and B
I set the status column
then set A, but not yet B, might setting A return inconsistent value whilst
still being set?

Thanks again for your help
Mark

2008/7/17 PHIL BERGSTRESSER <phil.bergstresser at adtran.com>:

>  Mark,
>     Glad that helped.
>     The zero is appended only to scalars for Get pdus. Not needed if you
> use a getNext of the basic OID. Never added for table objects because they
> have an index to indicate the specific instance. You might think the 0 is
> superfluous on scalars, but that is just the way SNMP is. So for simple
> Gets, there will be a trailing 0 for scalars, or an index for table objects.
>     HTH
> Phil
>
>  ------------------------------
> *From:* Mark Brand [mailto:markcbrand at googlemail.com]
> *Sent:* Thursday, July 17, 2008 5:25 AM
> *To:* PHIL BERGSTRESSER
> *Cc:* snmp4j at agentpp.org
> *Subject:* Re: [SNMP4J] Plea for help from an SNMP beginner
>
>  Thanks for your help - i thought I finally had the addressing methods
> right...
> It seems to work now, after changing the address.
>
> One more question though - some of my previous code didn't work until I put
> the ".0" at the end - is it always superfluous,
> or is there some circumstance under which I should use it?
>
> Thanks again,
> Mark
>
> 2008/7/16 PHIL BERGSTRESSER <phil.bergstresser at adtran.com>:
>
>> Mark,
>>    You are not addressing the table entries correctly. The row-status
>> column at ...7.2.1.10 is the table row, so the OIDs for the other
>> columns will be 7.2.1.y.x where y is the column variable desired, and x
>> is the row index. You will not end with a zero as that is superfluous
>> and imples a scalar, so just drop that.
>>    Does this help?
>> Phil
>>
>>
>> > -----Original Message-----
>> > From: snmp4j-bounces at agentpp.org
>> > [mailto:snmp4j-bounces at agentpp.org] On Behalf Of Mark Brand
>> > Sent: Wednesday, July 16, 2008 10:50 AM
>> > To: snmp4j at agentpp.org
>> > Subject: [SNMP4J] Plea for help from an SNMP beginner
>> >
>> > Hello,
>> >
>> > Basically my situation is that I am writing an API in java
>> > for communication with a piece of software, which is
>> > effectively a black-box (to me). The only way in which I can
>> > communicate with aforementioned black box is by snmp, and
>> > since snmp4j looked well written, I decided to use it.
>> >
>> > Fast forward a couple of days, and I have achieved a lot of
>> > what I need to achieve in terms of communicating with the
>> > software - I can happily read out entries, write entries and
>> > walk around inside.
>> >
>> > PROBLEM: Creating rows in a table - I need to create a row in
>> > a table, according to the documentation for the blackbox i
>> > should do this in what seems to be the standard way, using
>> > the status row.
>> >
>> > Quick Sanity check: if the OID for the table is
>> > 1.3.6.1.4.1.9944.1.1.1.7.2.1 and the OID for the status
>> > column is 1.3.6.1.4.1.9944.1.1.1.7.2.1.10 then I want to be
>> > editing the entries 1.3.6.1.4.1.9944.1.1.1.7.2.1.10.x.0 ?
>> >
>> > My code at the moment looks roughly like this:
>> >
>> > String reg = new String(
>> > "1.3.6.1.4.1.9944.1.1.1.7.2.1.10."+nodeIndex+".0");
>> > Variable var = new Integer32( 5 );
>> > OID oid = new OID( reg );
>> > VariableBinding vb = new VariableBinding(); vb.setOid( oid );
>> > vb.setVariable( var ); PDU setPdu = new PDU(); setPdu.add( vb
>> > ); setPdu.setType( PDU.SET );
>> >
>> > ResponseEvent event = snmp.send( setPdu, target );
>> >
>> > and the problem I have is that event always has the error set
>> > as General Variable Binding Error. Has anyone got any idea
>> > why this might happen?
>> > It would seem that something is actually happening when I
>> > call it, because if I then make a get request to another
>> > entry in the table (which I need to then
>> > set) I receive a null ref instead of getting any error message.
>> >
>> > Thanks in advance for any help you can offer
>> >
>> > Mark
>> > _______________________________________________
>> > SNMP4J mailing list
>> > SNMP4J at agentpp.org
>> > http://lists.agentpp.org/mailman/listinfo/snmp4j
>> >
>>
>
>



More information about the SNMP4J mailing list