Hie Dave,
I have implemented C code using mib2c.create-dataset.conf ( with cache
enabled)
As in my getfield(tmp, 2); function I am reading CSV file and geting value
of 2nd column.
If I run this function on normal mode It is reading whole file with lakes of
rows... but with SNMP generated code If I use SNMPWALK if the data presents
about 4000-7000 lines only(with 3 columns) it reads properly, If I increase
data SNMPWALK gives "Error in packet. 
Reason (genError)A general failure occurred 
Faild Object :XXX-MIB::yyy  
 
If I decrease column 3 to 1, It reads up to 21000 rows..
I am not sure Why It is occurring ...Is this because of Large amount of data
in a table ???? How to resolve it ??????  
 
Table:::load function :::::::

 

int Table_load( netsnmp_cache *cache, void *vmagic )

{

      long idx = 0;

      netsnmp_tdata     *table = (netsnmp_tdata *)vmagic;

      netsnmp_tdata_row *row;

      struct poolTable_entry *this;

      char buf[STRMAX];

      long  poolIndex = 1;

 

      /* column items (dummy values for now */

      long nOctets = 0;

      char line[1024];

      char *pstr;

        char* inOctets;

 

      FILE* stream = fopen("file.csv", "r");

      if ( !stream ) 

      {

            return -1;

      }

      snmp_log(LOG_ERR, "Table_load: loaded %s\n", "file.csv"); 

 

      while (fgets(line, 1024, stream))

      {

            char* tmp = strdup(line);

      

            row = poolTable_createEntry(table, poolIndex++);

            if (row == NULL)

            {

                  continue;

            }

            this = (struct poolTable_entry *)row->data;

 

            inOctets=getfield(tmp, 2);  /*data reading function returning
value(2 for second column) in string format*/

            this->poolIndex = poolIndex;

      

            nOctets =strtol(inOctets,&pstr,10); /* convert returning value
in INT format*/

            free(inOctets);

 

            this->poolInOctets =nOctets;

 

            // NOTE strtok clobbers tmp

            free(tmp);

      }

      return;   

}

 

 

File.csv 

1,22,32

2,34,52

3,24,34

...

...

 

Thanks in Advance,

-Jatin

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to