For all those who are interested, I found out what's wrong. You will have to
specify ASN_OCTET_STR as value type, not ASN_BIT_STR. I have absolutely no
idea why and it's very supprising from my point of view, but it works.
It would be a great help, if there was a method that allowed to determine
the ASN type to be passed to setValue() from the OID. Unfortunately neither
SNMP::getType() nor accessing the element in %SNMP::MIB will help here,
both return BITS.
> Hi all,
>
> I managed to implement my own sub-agent in Perl using Agent.pm and it
> works pretty well apart from one point. The MIB the sub-agent is dealing
> with contains one object that is defined in this way:
>
> XxxEntry ::= SEQUENCE {
> internalError
> TCRMINTERNALERROR,
> ...
> }
> TCRMINTERNALERROR ::= TEXTUAL-CONVENTION
> STATUS current
> DESCRIPTION "foo bar"
> SYNTAX BITS {
> bit0(0), bit1(1), bit2(2), bit3(3),
> bit4(4), bit5(5), bit6(6), bit7(7),
> bit8(8), bit9(9), bit10(10), bit11(11),
> bit12(12), bit13(13), bit14(14), bit15(15),
> bit16(16), bit17(17), bit18(18), bit19(19),
> bit20(20), bit21(21), bit22(22), bit23(23),
> bit24(24), bit25(25), bit26(26), bit27(27),
> bit28(28), bit29(29), bit30(30), bit31(31) }
>
> My problem is that I could not manage to use Agent::setValue() appropriately.
> I already tried a lot, but I could not find out the right coding for my
> numerical value. For example, if I have a numerical value for "internalError"
> of 0xabcdabcd (2882382797), how will I have to set $value (I supppose $type
> will be ASN_BIT_STR)?
>
> $request->setValue($type, $value);
>
> Currently "snmpget localhost internalError.1" always gives me
>
> Error in paket
> Reason: (genError) A general failure occured
>
> and a look into "wireshark" tells me something like "noSuchInstance".
------------------------------------------------------------------------------
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders