Good luck - that's A LOT of work.

I really think you would have more results using the existing interfaces to
a database and writing a retrieval structure out of there.

Here's why:  All of the code in Ntop assumes that this big, global,
structure, myGlobals, exists and that you can get to all of the data from
it.  For example, the data about a specific interface ("device") is pointed
to by myGlobals.device[].  Within that are counters and further structures,
relating, say to a specific host seen on that device.

     el = myGlobals.device[actualReportDeviceId].hash_hostTraffic[elIdx];

or

  for(idx=1; idx<myGlobals.device[actualReportDeviceId].actualHashSize;
idx++) {
    if((idx != myGlobals.otherHostEntryIdx)
        && ((el =
myGlobals.device[actualReportDeviceId].hash_hostTraffic[idx]) != NULL)
       && (broadcastHost(el) == 0)) {
      if(((trafficReportType == TRAFFIC_REPORT_SENT) && (el->bytesSent > 0))
         || ((trafficReportType == TRAFFIC_REPORT_RECEIVED) &&
(el->bytesRcvd > 0))) {
        if((reportType == REPORT_TYPE_IPPROTOS) && (el->hostNumIpAddress[0]
== '\0')) continue;
        tmpTable[numEntries++]=el;
        /* Grab the peak throughput (bytes/sec) for later formatting */
        if (el->peakSentThpt > peakThroughput)
            peakThroughput = el->peakSentThpt;
        if (el->peakRcvdThpt > peakThroughput)
            peakThroughput = el->peakRcvdThpt;
      }
    }
  }

Check out ntop.h, around 858 and globals.h, around 56.

Dumping it isn't too hard ... conceptually either piggy back off the
periodic update thread or create a new one.  However, you will have to be
very careful regarding mutexes so that you get a consistent set of data and
don't risk deadlocks.

Reloading it isn't too hard either...

However, what I think would kill you is the changing 90% of the reporting
code to allow it to point at a different structure, myGlobalsHistorical.xxxx
Or, you would have to create a reporting-only clone, a separate, historical,
single-threaded app.  Rip all of the packet reading, etc code out and leave
just the display shell.  Add a 1st level menu which reads the days data into
the structures (which now don't change) and then invoke the existing
displays.

And then set things up so you don't have to maintain two completely
different code bases at once...

-----Burton


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
Of Davinder Singh - McLean
Sent: Thursday, February 07, 2002 10:53 AM
To: '[EMAIL PROTECTED]'
Subject: [Ntop-dev] Daily captures



I want to capture stat on daily basis and store it.I would like to retrieve
the traffic stat of that particular day from browser as Is being done
now.Ntop is running on Linux.
It should display the traffic of that particular day in the same manner as
it displays the current traffic info.


Davinder Singh
Network Services

Phone no.: 703-245-5331

_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listmanager.unipi.it/mailman/listinfo/ntop-dev

_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listmanager.unipi.it/mailman/listinfo/ntop-dev

Reply via email to