Hi Umut,
The proper way to do this would be via an API to ntopng, but we are in
the process of releasing the next stable version so new features must wait.
What you can do right now is quering ntopng for an host stats like this:
curl --cookie "user=admin; password=your_password"
"http://127.0.0.1:3000/lua/do_export_data.lua?ifid=0&ip=192.168.1.1"
It will return a JSON with "rcvd.bytes" but it does not reset daily.
An alternative is to setup a global alert threshold on traffic for your
local hosts, so that after the threshold is crossed by any local host,
an alert is generated and stored to the "closed_alerts" table of the
SQLite database "/var/tmp/ntopng/0/alerts/alerts_v5.db". You can setup
this from any local host details page, through the icon with the
esclamation mark. You can then filter that database to see if the host
has exceeded the quota and take an action.
This is very complex for a really simple task, but again please wait we
complete the next release and then we will expose an api for this.
Emanuele
On 05/08/2017 08:52 PM, Umut Arus wrote:
Hello Emanuele,
Thanks for your reply I have tried to store mysql data. But I have
collected huge amount of 250.000 rows with about 10.000 clients in
only five minutes. In this case, it wouldn't be practical.
If you can help about summarize the data inside "redis" of ntopng
it'll be better...
thanks.
On Mon, May 8, 2017 at 4:04 PM, Emanuele Faranda <[email protected]
<mailto:[email protected]>> wrote:
Hi,
Currently ntopng does not export such daily information via an
API. Feel free to open a feature request on github
https://github.com/ntop/ntopng for an API request.
As an alternative, if you have MySQL support enabled (see -F
option), you could perform manual MySQL aggregations from the
database.
Another alternative is to read data from the RRD files which
ntopng creates every 5 minute for local hosts (see -m option for
defining local networks). In this case, you could read the
statistics of the host 192.168.1.1 with the command "rrdtool fetch
/var/tmp/ntopng/0/rrd/192/168/1/1/bytes.rrd AVERAGE -s now-1d".
The first column of the output contains the downloaded host
traffic, while the second the uploaded traffic.
This approach has the following implications:
- data is actually an average of the host traffic in 5 minutes,
not the actual traffic
- data is not aggregated, you will need to sum up the rows values
to get the total
- you will need to multiply the row value by 300, since values are
derivates
See https://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html
<https://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html> for more details.
Regards,
Emanuele
On 05/07/2017 01:21 PM, Umut Arus wrote:
Hi,
I'd like to collect of clients downloaded data per IP every day
so I'll integrate it for home made quota management per IP.
How can I get the data of total bytes from an API or cli from ntopng?
thanks.
--
*Umut Arus*
*
*
Information Technology
Sabancı University
_______________________________________________
Ntop mailing list
[email protected] <mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop
<http://listgateway.unipi.it/mailman/listinfo/ntop>
_______________________________________________
Ntop mailing list
[email protected] <mailto:[email protected]>
http://listgateway.unipi.it/mailman/listinfo/ntop
<http://listgateway.unipi.it/mailman/listinfo/ntop>
--
*Umut Arus*
System Specialist
Information Technology
Sabancı University
Phone: +90216 483 9172
_______________________________________________
Ntop mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop
_______________________________________________
Ntop mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop