NAME
Plack::App::OpenVPN::Status - Plack application to display the sessions of OpenVPN server
SYNOPSIS
use Plack::Builder;
use Plack::App::File;
use Plack::App::OpenVPN::Status;
builder {
mount '/static' => Plack::App::File->new(root => "/path/to/static");
mount '/' =>
Plack::App::OpenVPN::Status->new(
status_from => "/path/to/openvpn/status.log"
);
};
DESCRIPTION
Plack::App::OpenVPN::Status is an application to display active sessions of the OpenVPN server.
It parse OpenVPN status log and display active sessions. Supported all three versions of the status log. Check the OpenVPN server documentation how to set up version. Howewer, there is no needs (and no ability, at the moment) to point version of status log. Application detect it authomatically. Also status log version will be diplayed on the generated web page.
Twitter Bootstrap layout is used to diplay active OpenVPN sessions.
METHODS
new([%options])
Creates a new application. The following options are supported:
- status_from
-
Path to OpenVPN server status log file. This option is required. At the moment, the application can able to read versions 1, 2, 3 of the status log file.
- custom_view
-
Coderef used as a view to display sessions. This must be a valid Text::MicroTemplate's template. The hashref of params is passed to the view as first argument. So you can use it like this:
% my $vars = $_[0];
Now $vars contains the structure like this:
$vars = { 'updated' => 'Wed Dec 5 21:25:58 2012', 'version' => '2', 'users' => [ { 'common-name' => 'cadvecisvo', 'remote-ip' => '1.2.3.4', 'remote-port' => '4944', 'rx-bytes' => '1.21 Mio', 'tx-bytes' => '503.1 Kio', 'connected' => 'Wed Dec 5 21:16:58 2012', 'virtual' => '00:ff:de:ad:be:ef', 'last-ref' => 'Wed Dec 5 21:25:55 2012', } ] }
default_view
This is the default view to display sessions. It uses Twitter Bootstrap layout.
SEE ALSO
AUTHOR
Anton Gerasimov, <chim@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2012 by Anton Gerasimov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.