Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- html/cgi-bin/logs.cgi/ovpnclients.dat | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat index 2009990ec..a064893a1 100755 --- a/html/cgi-bin/logs.cgi/ovpnclients.dat +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -95,6 +95,21 @@ unless ($to_datestring ge $from_datestring) { $errormessage = "$Lang::tr{'error the to date has to be later than the from date'}"; }
+# Initialise database +my $cursor = $database_handle->prepare(" + CREATE TABLE IF NOT EXISTS sessions( + common_name TEXT NOT NULL, + connected_at TEXT NOT NULL, + disconnected_at TEXT, + bytes_received INTEGER, + bytes_sent INTEGER + ); + + -- Create index for speeding up searches + CREATE INDEX IF NOT EXISTS sessions_common_name ON sessions(common_name); +"); +$cursor->execute(); + my $database_query = qq( SELECT common_name, SUM(
Signed-off-by: Michael Tremer michael.tremer@ipfire.org --- config/rootfiles/core/145/update.sh | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/config/rootfiles/core/145/update.sh b/config/rootfiles/core/145/update.sh index 5f5394f78..9ff64f7f9 100644 --- a/config/rootfiles/core/145/update.sh +++ b/config/rootfiles/core/145/update.sh @@ -73,6 +73,13 @@ for package in perl-DBI perl-DBD-SQLite; do rm -f /opt/pakfire/db/rootfiles/$package done
+# Enable OpenVPN metrics collection +cat <<EOF >> /var/ipfire/ovpn/server.conf +# Log clients connecting/disconnecting +client-connect "/usr/sbin/openvpn-metrics client-connect" +client-disconnect "/usr/sbin/openvpn-metrics client-disconnect" +EOF + # Start services /etc/init.d/vnstat start /etc/init.d/unbound restart