Sorry again, the are mistakes in the code I give you.

Here is the correct one.


Sorry Dave, but I give you my MIB in previous mails; I give you my MIB again as it would make things clearer.

Concerning range_subid, there was a mistake in the code I give (error on copy/paste)... sorry...

My table is defined something like that:
genRoot (99999)
---- genTestRoot (10000)
--------- genMetrics (1)
--------------- genServerTable (1)
---------------------genServerEntry (1)
-------------------------- genServerIndex (1)
-------------------------- genServerName (2)
-------------------------- genServerProductName (3)
-------------------------- genServerHostname (4)
-------------------------- genServerPID (5)

After reading RFC 2741 (with pointers to range_subid and range_ubound)

So now, what I'm doing is:

// Declare the Oid of genServerTable
oid genServerTableOid[] =
   { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1 };

size_t genServerTableOidLen = OID_LENGTH(genServerTableOid);

// Get an unique index from the master agent
u_long allocatedIndex = register_int_index(genServerTableOid,
genServerTableOidLen, ANY_INTEGER_INDEX);

// Strangely, it has to begin with the index 2... @todo
while ( allocatedIndex <= 1 && allocatedIndex > 0 )
{
    allocatedIndex = register_int_index(genServerTableOid,
genServerTableOidLen, ANY_INTEGER_INDEX);
}

// Define the oid of the first column from the index returned
oid genServerAllocatedOid[] =
   { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1, 1, allocatedIndex };
size_t genServerAllocatedOidLen = OID_LENGTH(genServerAllocatedOid);

// Define the structure of the table
netsnmp_table_data_set *genServerTable = netsnmp_create_table_data_set("genServerTable");
nesnmp_table_dataset_add_index(genServerTable, ASN_UNSIGNED);
netsnmp_table_set_multi_add_default_row(genServerTable,
                                           2,
                                           ASN_OCTET_STR, 0, NULL, 0,
                                           3,
                                           ASN_OCTET_STR, 0, NULL, 0,
                                           4,
                                           ASN_OCTET_STR, 0, NULL, 0,
                                           5,
ASN_UNSIGNED, 0, NULL, 0, 0);

netsnmp_handler_registration * handlerServerTable = netsnmp_create_handler_registration
("genServerTable",
NULL,
genServerAllocatedOid,
genServerAllocatedOidLen,
HANDLER_CAN_RONLY);

// Set the range_subid to the first column of the row
handlerServerTable->range_subid = genServerAllocatedOidLen;

// set the range_ubound
handlerServerTable->range_ubound = 5;
}


From: "Dave Shield" <[EMAIL PROTECTED]>
To: "Arnaud BODENAN" <[EMAIL PROTECTED]>
CC: net-snmp-users@lists.sourceforge.net
Subject: Re: multiple Sub-agents managing the same table
Date: Tue, 5 Sep 2006 10:07:14 +0100

On 05/09/06, Arnaud BODENAN <[EMAIL PROTECTED]> wrote:
Thanks Dave. What I've done now is:

I'm sorry - this code is meaningless to me.
You're listing assorted numeric OIDs, but I have no idea what MIB
objects they refer to.

I'm pretty sure that they aren't correct, since:

// Declare the top Oid for my table
oid genServerTableOid[] =   { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1 };

// Define the oid of the first column from the index returned
oid genServerAllocatedOid[] = { 1, 3, 6, 1, 4, 1, 99999, 10000, 1, 1, allocatedIndex };

don't seem to match.   I'd expect another field in the column-instance
OID array.
But you've never listed your MIB file, so I'm forced to guess. And
quite frankly, I don't have the time to waste at the moment.


I'm also not confident that initialising an array using another
variable is particularly safe.
You'd probably be much safer using a dummy placeholder field, and
explicitly inserting the index value:

oid genServerAllocatedOid[] =    { 1, 3, 6, 1, 4, 1, 99999, 10000, 1,
1, 1?,  999 };
genServerAllocatedOid[ genServerAllocatedOidLen-1 ] = allocatedIndex;


// Set the range_subid to the first column of the row
handlerServerTable->range_subid = genServerAllocatedOid;

No
The range_subid is an *index* into this array - not the whole OID.
Please re-read the AgentX specifications.  You clearly haven't grasped
how this mechanism works.


// set the range_ubound ???
handlerServerTable->range_ubound = allocatedIndex;

No.
This is the value of the maximum column *object* subidentifier (the
bit you seem to have omitted in the earlier code).   Not the row index
(instance) subidentifier.




If I understand you, I should set range_ubound to 5 (I have five columns in
my row) ?

Yes.   Or at least Probably.
I can't be sure, 'cos you've never shown us the MIB file that defines
this table.
If there are five columns in the table, they would typically be numbered 1..5,
in which case range_ubound would indeed be 5.
  But if they're numbered 2..6 (for example) then ubound would be 6.


Dave

_________________________________________________________________
Windows Live Spaces is here! ItÂ’s easy to create your own personal Web site. http://spaces.live.com/signup.aspx




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


_______________________________________________
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

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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