E
E
eksmans2016-10-11 16:25:19
VPN
eksmans, 2016-10-11 16:25:19

How to calculate traffic statistics for openvpn?

Greetings. either I googled it wrong, or the task is unpopular ..
In general, there is a task - to calculate how much traffic a particular ip connected to vpn consumed.
Per day, month and total value.
By default, openvpn only shows the traffic count of those who are "online", in the file /etc/openvpn/openvpn-status.log
Do I understand correctly that openvpn does not keep statistics itself, and the maximum that can be written to /etc/openvpn/ openvpn-status.log current connections?
If so, then there is an idea to make this option:
Specify the path to the openvpn-status.log log somewhere in a folder on the web server.
Next, write, say, a php script that will parse this log every minute and keep statistics.
But somehow this option seems a perversion to me... Surely there are ready-made solutions, openvpn log parsers for my needs.
Preferably a parser with a web face that would show all ever connected ip, and statistics on them, per day, month and total.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry, 2016-10-11
@Tabletko

As an option - put Squid after VPN

A
Andreyky, 2016-10-11
@Andreyky

searched myself. like in the server configs there are parameters "--client-disconnect cmd" which executes the script when the client is disconnected and there are bytes_received and bytes_sent variables and many more. you can read more - https://community.openvpn.net/openvpn/wiki/Openvpn... section "Environmental Variables". if it turns out to blind something from this knowledge, it will be interesting to look at the result.

E
eksmans, 2016-10-11
@eksmans

Yes, I just thought that there is a ready-made solution specifically for openvpn :)
In general, I decided to use ntop configured for the openvpna network interface.
I haven’t figured out how to look at statistics by day yet, really ..
Also, in the process of googling, I came across darkstat, which is also a good solution. And what is important is very easy.
By the way, the general status on openvpn can be viewed stupidly through ifconfig (at the bottom under each interface the number of passing traffic will be displayed), openvpn sits on tun0 by default
Maybe it will help someone :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question