Re: Obtain the number of instances in a table

Francois Bouchard <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAAZiaZftOQ+9O2XbBF8o_vAjRywVPEoQSnDVFA_38LTJBh15tw@mail.gmail.com>
Thanks,



Finally the max entry is not really needed for validation.  The following
code block (check if table entry exists ) will validate the entry.



    case MODE_SET_RESERVE1:
        for (request=requests; request; request=request->next) {
            table_entry = (struct mpbcRMHOTMTable_entry *)
                              netsnmp_tdata_extract_entry(request);
            table_info  =     netsnmp_extract_table_info( request);

*         /* check if table entry exists */
         if (! table_entry)
           {
           snmp_log(LOG_ERR, "Error table entry not existing\n");
           netsnmp_set_request_error( reqinfo, request,   SNMP_NOSUCHOBJECT
);
             continue;
         } *
          (...)

Francois



One more question,

2012/3/20 Dave Shield <[email protected]>

> On 20 March 2012 16:23, Francois Bouchard <[email protected]>
> wrote:
> > Is there also a way to known the table length (in number of rows) ?
>
> In general, no.
>
> Depending on how the table is represented internally, the agent may
> not have access to this information at all  (e.g. if you're using the
> iterator approach and pulling the data from some external source).
>
> If you've got an internally cached version of the table, then that
> information is clearly available, but how you calculate it will depend
> on how the table is stored.
>
> Probably the simplest approach, particularly if you're using the cache
> helper, would be for the cache load routine to count the number of
> rows as it loads the table, and store this information in a file-scoped
> variable.
>
> Dave
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.