2009/10/6 niepa inter <yanni...@yahoo.com>:
> I have generated a code for snmp using mib-2c (data-set). It works, howerver
> it won't let me add additional column to the predefined ones.

Are you talking about adding a new column to the table, or adding a new row?

>                                                   Let say I have
> the oid ".1.2.3.4.COLUMN_SENSE1". I can add a row to it and I obtain
> ".1.2.3.4.COLUMN_SENSE1.1"

OK - so far.   This OID represents the value of  "columnSense1" in the first
row of the table.

>                                 but I don't have a way to add and additional
> column with for example oid ".1.2.3.4.COLUMN_SENSE1.2"

But this OID represents the value of the same column in the second row
of the table.   I.e. this is a new *row*, not a new column.

>                                        that will follow
> directly the previous oid while remaining in the same table.



> I have tried to do another netsnmp_create_table_data_row(); and repeat the
> process below but it does not work. It just add row an additional row to the
> oid and I end up with something like this : ".1.2.3.4.COLUMN_SENSE1.1.1".

That seems to be changing the indexing of the table.
It's now using two index objects, instead of one.

You should *NOT* change this on the fly.


> I have part of my code below.
> Any idea ? Thanks
>
> Here is my snippet:
>
>     netsnmp_table_dataset_add_row(table_set, row);
>
>     row = netsnmp_create_table_data_row();
>     netsnmp_table_row_add_index(row, ASN_INTEGER, &pkt->index,
> sizeof(pkt->index));
>     netsnmp_table_row_add_index(row, ASN_INTEGER, &pkt->index,
> sizeof(pkt->index));

And that's why - you are adding two indexes to the row that you've
just created.   So the agent code is doing exactly what you've asked
it to.   It doesn't know that this is nonsense - it assumes (wrongly!)
that you know what you are doing....


If you want to add a second row to the table, then you need
to call "row = netsnmp_create_table_data_row()"  again.
Each time you need a new row, you must create it.


As Mike says - creating new columns on the fly is very very
unusual.   I've never come across an example of this in all
my time working with SNMP.   And none of the table helpers
support this.

I would be *VERY* surprised if this is actually what you want
to do.   Adding new rows to a table, however, is perfectly normal.
See above.

Dave

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to