Merge remote-tracking branch 'amarx/vpn-statistic1' into next

This commit is contained in:
Michael Tremer
2015-01-13 17:37:18 +01:00
14 changed files with 336 additions and 7 deletions

View File

@@ -587,6 +587,118 @@ sub updateifgraph {
print "Error in RRD::graph for ".$interface.": ".$ERROR."\n" if $ERROR;
}
sub updatevpngraph {
my $interface = $_[0];
my $period = $_[1];
RRDs::graph(
"-",
"--start",
"-1".$period,
"-aPNG",
"-i",
"-z",
"-W www.ipfire.org",
"--alt-y-grid",
"-w 600",
"-h 125",
"-r",
"-t ".$Lang::tr{'traffic on'}." ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
"-v ".$Lang::tr{'bytes per second'},
"--color=SHADEA".$color{"color19"},
"--color=SHADEB".$color{"color19"},
"--color=BACK".$color{"color21"},
"DEF:incoming=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive.rrd:rx:AVERAGE",
"DEF:outgoing=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive.rrd:tx:AVERAGE",
"CDEF:outgoingn=outgoing,-1,*",
"COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
"AREA:incoming#00dd00:".sprintf("%-20s",$Lang::tr{'incoming traffic in bytes per second'}),
"GPRINT:incoming:MAX:%8.1lf %sBps",
"GPRINT:incoming:AVERAGE:%8.1lf %sBps",
"GPRINT:incoming:MIN:%8.1lf %sBps",
"GPRINT:incoming:LAST:%8.1lf %sBps\\j",
"AREA:outgoingn#dd0000:".sprintf("%-20s",$Lang::tr{'outgoing traffic in bytes per second'}),
"GPRINT:outgoing:MAX:%8.1lf %sBps",
"GPRINT:outgoing:AVERAGE:%8.1lf %sBps",
"GPRINT:outgoing:MIN:%8.1lf %sBps",
"GPRINT:outgoing:LAST:%8.1lf %sBps\\j",
);
$ERROR = RRDs::error;
print "Error in RRD::graph for ".$interface.": ".$ERROR."\n" if $ERROR;
}
sub updatevpnn2ngraph {
my $interface = $_[0];
my $period = $_[1];
RRDs::graph(
"-",
"--start",
"-1".$period,
"-aPNG",
"-i",
"-z",
"-W www.ipfire.org",
"--alt-y-grid",
"-w 600",
"-h 125",
"-r",
"-t ".$Lang::tr{'traffic on'}." ".$interface." ".$Lang::tr{'graph per'}." ".$Lang::tr{$period."-graph"},
"-v ".$Lang::tr{'bytes per second'},
"--color=SHADEA".$color{"color19"},
"--color=SHADEB".$color{"color19"},
"--color=BACK".$color{"color21"},
"DEF:incoming=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive-traffic.rrd:rx:AVERAGE",
"DEF:outgoing=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive-traffic.rrd:tx:AVERAGE",
"DEF:overhead_in=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive-overhead.rrd:rx:AVERAGE",
"DEF:overhead_out=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/if_octets_derive-overhead.rrd:tx:AVERAGE",
"DEF:compression_in=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/compression_derive-data_in.rrd:uncompressed:AVERAGE",
"DEF:compression_out=".$mainsettings{'RRDLOG'}."/collectd/localhost/openvpn-$interface/compression_derive-data_out.rrd:uncompressed:AVERAGE",
"CDEF:outgoingn=outgoing,-1,*",
"CDEF:overhead_outn=overhead_out,-1,*",
"CDEF:compression_outn=compression_out,-1,*",
"COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),
"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j",
"AREA:incoming#00dd00:".sprintf("%-20s",$Lang::tr{'incoming traffic in bytes per second'}),
"GPRINT:incoming:MAX:%8.1lf %sBps",
"GPRINT:incoming:AVERAGE:%8.1lf %sBps",
"GPRINT:incoming:MIN:%8.1lf %sBps",
"GPRINT:incoming:LAST:%8.1lf %sBps\\j",
"STACK:overhead_in#116B11:".sprintf("%-20s",$Lang::tr{'incoming overhead in bytes per second'}),
"GPRINT:overhead_in:MAX:%8.1lf %sBps",
"GPRINT:overhead_in:AVERAGE:%8.1lf %sBps",
"GPRINT:overhead_in:MIN:%8.1lf %sBps",
"GPRINT:overhead_in:LAST:%8.1lf %sBps\\j",
"LINE1:compression_in#ff00ff:".sprintf("%-20s",$Lang::tr{'incoming compression in bytes per second'}),
"GPRINT:compression_in:MAX:%8.1lf %sBps",
"GPRINT:compression_in:AVERAGE:%8.1lf %sBps",
"GPRINT:compression_in:MIN:%8.1lf %sBps",
"GPRINT:compression_in:LAST:%8.1lf %sBps\\j",
"AREA:outgoingn#dd0000:".sprintf("%-20s",$Lang::tr{'outgoing traffic in bytes per second'}),
"GPRINT:outgoing:MAX:%8.1lf %sBps",
"GPRINT:outgoing:AVERAGE:%8.1lf %sBps",
"GPRINT:outgoing:MIN:%8.1lf %sBps",
"GPRINT:outgoing:LAST:%8.1lf %sBps\\j",
"STACK:overhead_outn#870C0C:".sprintf("%-20s",$Lang::tr{'outgoing overhead in bytes per second'}),
"GPRINT:overhead_out:MAX:%8.1lf %sBps",
"GPRINT:overhead_out:AVERAGE:%8.1lf %sBps",
"GPRINT:overhead_out:MIN:%8.1lf %sBps",
"GPRINT:overhead_out:LAST:%8.1lf %sBps\\j",
"LINE1:compression_outn#000000:".sprintf("%-20s",$Lang::tr{'outgoing compression in bytes per second'}),
"GPRINT:compression_out:MAX:%8.1lf %sBps",
"GPRINT:compression_out:AVERAGE:%8.1lf %sBps",
"GPRINT:compression_out:MIN:%8.1lf %sBps",
"GPRINT:compression_out:LAST:%8.1lf %sBps\\j",
);
$ERROR = RRDs::error;
print "Error in RRD::graph for ".$interface.": ".$ERROR."\n" if $ERROR;
}
# Generate the Firewall Graph for the current period of time for values given by collecd
sub updatefwhitsgraph {

View File

@@ -92,3 +92,4 @@ include "/etc/collectd.precache"
#include "/etc/collectd.thermal"
include "/etc/collectd.custom"
include "/etc/collectd.vpn"

View File

@@ -0,0 +1,5 @@
LoadPlugin openvpn
<Plugin openvpn>
StatusFile "/var/run/ovpnserver.log"
</Plugin>

View File

@@ -40,6 +40,18 @@
'title' => "$Lang::tr{'network other'}",
'enabled' => 1,
};
$substatus->{'53.networkovpn'} = {
'caption' => "$Lang::tr{'openvpn client'}",
'uri' => '/cgi-bin/netovpnrw.cgi',
'title' => "$Lang::tr{'openvpn client'}",
'enabled' => 1,
};
$substatus->{'54.networkovpnsrv'} = {
'caption' => "$Lang::tr{'openvpn server'}",
'uri' => '/cgi-bin/netovpnsrv.cgi',
'title' => "$Lang::tr{'openvpn server'}",
'enabled' => 1,
};
$substatus->{'60.hardwaregraphs'} = {
'caption' => "$Lang::tr{'hardware graphs'}",
'uri' => '/cgi-bin/hardwaregraphs.cgi',

View File

@@ -1419,6 +1419,8 @@ srv/web/ipfire/cgi-bin/modem-status.cgi
srv/web/ipfire/cgi-bin/netexternal.cgi
srv/web/ipfire/cgi-bin/netinternal.cgi
srv/web/ipfire/cgi-bin/netother.cgi
srv/web/ipfire/cgi-bin/netovpnrw.cgi
srv/web/ipfire/cgi-bin/netovpnsrv.cgi
srv/web/ipfire/cgi-bin/optionsfw.cgi
srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/p2p-block.cgi

View File

@@ -2,6 +2,7 @@ etc/collectd.conf
etc/collectd.custom
etc/collectd.precache
etc/collectd.thermal
etc/collectd.vpn
etc/rc.d/init.d/collectd
etc/rc.d/rc0.d/K50collectd
etc/rc.d/rc3.d/S29collectd