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

Frank Fock fock at agentpp.com
Fri Jun 17 23:22:29 CEST 2011


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




More information about the AGENTPP mailing list