[AGENT++] segmentation fault when using snmptable and "Wrong Type" when using snmpwalk

Marc Van Daele marc.van.daele at zappware.com
Mon Jun 20 13:47:13 CEST 2011


FYI.

Problem was solved by replacing "1.3.6.1.4.1.36064.1.1.1.1" by
"1.3.6.1.4.1.36064.1.1.1.1.1" (one additional ".1" for the recordingEntry)

Kind Regards,

Marc

On 06/18/2011 02:49 PM, Marc Van Daele wrote:
> Hello Frank,
>   
> Thanks for your response.
> Can you give me a pointer (example, api, ...) as to how I should create indices manually?
>   
> Thanks in advance,
>   
> Marc
>> -----Origineel Bericht-----
>> Van: "Frank Fock"<fock at agentpp.com>
>> Aan: agentpp at agentpp.org
>> Datum: 17/06/2011 23:22
>> Onderwerp: Re: [AGENT++] segmentation fault when using snmptable and "Wrong Type" when using snmpwalk
>>
>> Hi,
>>
>> get_next_avail_index seems not to work for your example.
>> Please try to create the indexes manually first.
>>
>> Best regards,
>> Frank
>>
>> On 17.06.2011 11:19, Marc Van Daele wrote:
>>> Hello,
>>>
>>> I'm trying to convert my code from net-snmp to agentpp.
>>> I try to create a simple table wherein every row consists of an index, a
>>> string and a RowStatus.
>>> I want to create the following table
>>>       1 "aaa" active
>>>       2 "bbb" active
>>>       3 "ccc" active
>>> and I would like to use snmptable on this table.
>>>
>>> However, when I run snmpwalk, I get
>>> [Marc at zapptop035 ~]$ snmpwalk -v2c -c public 127.0.0.1
>>> FLUX-MIB::recordingsTable
>>> FLUX-MIB::recordingIdx = INTEGER: 1
>>> FLUX-MIB::recording = Wrong Type (should be OCTET STRING): INTEGER: 2
>>> FLUX-MIB::recordingRowStatus = INTEGER: notReady(3)
>>> FLUX-MIB::recordingsTable.2.1 = STRING: "aaa"
>>> FLUX-MIB::recordingsTable.2.2 = STRING: "bbb"
>>> FLUX-MIB::recordingsTable.2.3 = STRING: "ccc"
>>> FLUX-MIB::recordingsTable.3.1 = INTEGER: 1
>>> FLUX-MIB::recordingsTable.3.2 = INTEGER: 1
>>> FLUX-MIB::recordingsTable.3.3 = INTEGER: 1
>>>
>>> and when I run snmptable, I get
>>> [Marc at zapptop035 ~]$ snmptable -v2c -c public 127.0.0.1
>>> FLUX-MIB::recordingsTable
>>> Segmentation fault (core dumped)
>>>
>>> so I guess I made a stupid error somewhere but I fail to locate it.
>>> Could someone have a look at the code fragment and MIB below?
>>>
>>> Thanks in advance,
>>>
>>> Marc
>>>
>>> My code is
>>>        const index_info indDynamicTable[] = {
>>>              { sNMP_SYNTAX_INT, FALSE, 1, 1 }
>>>        };
>>>
>>>        ExampleTable::ExampleTable(): MibTable(
>>>                //"1.3.6.1.4.1.4976.6.2.1",
>>>                "1.3.6.1.4.1.36064.1.1.1.1",
>>>                indDynamicTable, 1)
>>>        {
>>>
>>>            currentRequest = 0;
>>>            add_listener(this);
>>>            add_col(new MibLeaf("1", READCREATE, new SnmpInt32(0),
>>> VMODE_NONE));
>>>            add_col(new MibLeaf("2", READCREATE, new OctetStr(""),
>>> VMODE_NONE));
>>>            add_col(new snmpRowStatus("3"));
>>>
>>>            Oidx oid =  get_next_avail_index();
>>>            MibTableRow* row = add_row(oid);
>>>            row->get_nth(0)->replace_value(new SnmpInt32(1));
>>>            row->get_nth(1)->replace_value(new OctetStr("aaa"));
>>>            row->get_nth(2)->replace_value(new SnmpInt32(rowActive));
>>>            oid =  get_next_avail_index();
>>>            row = add_row(oid);
>>>             row->get_nth(0)->replace_value(new SnmpInt32(2));
>>>            row->get_nth(1)->replace_value(new OctetStr("bbb"));
>>>            row->get_nth(2)->replace_value(new SnmpInt32(rowActive));
>>>            oid =  get_next_avail_index();
>>>            row = add_row(oid);
>>>            row->get_nth(0)->replace_value(new SnmpInt32(3));
>>>            row->get_nth(1)->replace_value(new OctetStr("ccc"));
>>>            row->get_nth(2)->replace_value(new SnmpInt32(rowActive));
>>>
>>>        }
>>>
>>> and my MIB is (this mib worked with net-snmp so I guess it is correct)
>>>
>>> recordingsTable OBJECT-TYPE
>>>        SYNTAX      SEQUENCE OF RecordingEntry
>>>        MAX-ACCESS  not-accessible
>>>        STATUS      current
>>>        DESCRIPTION "The table with recordings"
>>>        ::= { rrec 1 }
>>>
>>> recordingEntry OBJECT-TYPE
>>>        SYNTAX      RecordingEntry
>>>        MAX-ACCESS  not-accessible
>>>        STATUS      current
>>>        DESCRIPTION "A single recording row"
>>>        INDEX   { recordingIdx }
>>>        ::= { recordingsTable 1 }
>>>
>>> RecordingEntry ::= SEQUENCE {
>>>        recordingIdx          Integer32,
>>>        recording             OCTET STRING,
>>>        recordingRowStatus    RowStatus
>>> }
>>>
>>> recordingIdx OBJECT-TYPE
>>>        SYNTAX      Integer32 (0..65000)
>>>        MAX-ACCESS  read-write
>>>        STATUS      current
>>>        DESCRIPTION "the ID of the recording"
>>>        ::= { recordingEntry 1 }
>>>
>>> recording OBJECT-TYPE
>>>        SYNTAX      OCTET STRING (SIZE(0..2048))
>>>        MAX-ACCESS  read-write
>>>        STATUS      current
>>>        DESCRIPTION "the XML fragment describing the recording"
>>>        ::= { recordingEntry 2 }
>>>
>>> recordingRowStatus OBJECT-TYPE
>>>        SYNTAX       RowStatus
>>>        MAX-ACCESS   read-write
>>>        STATUS       current
>>>        DESCRIPTION "The status of this recording"
>>>        ::= { recordingEntry 3 }
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> AGENTPP mailing list
>>> AGENTPP at agentpp.org
>>> http://lists.agentpp.org/mailman/listinfo/agentpp
>> -- 
>> AGENT++
>> http://www.agentpp.com
>> http://www.snmp4j.com
>> http://www.mibexplorer.com
>> http://www.mibdesigner.com
>>
>> _______________________________________________
>> AGENTPP mailing list
>> AGENTPP at agentpp.org
>> http://lists.agentpp.org/mailman/listinfo/agentpp
>
> _______________________________________________
> AGENTPP mailing list
> AGENTPP at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/agentpp




More information about the AGENTPP mailing list