squid-graph 3.2: Proxy Graphs rebuilt (V2)
Commit Message
This is a rather old fellow.
For details see:
https://sourceforge.net/projects/squid-graph/
"Squid Graph is a free, simple, yet powerful Squid v2 native logfile analysis tool
that generates reports with graphical representation of the proxy server's traffic,
somewhat like the popular MRTG tool."
I found by chance that the corresponding translation strings were still present,
so I thought "Why not?". ;-)
Here, it works without problems and 'squid 3.5.27'.
The original 'sgraph.cgi' was slightly tuned - like in IPCop - and polished for better readability.
If someone likes it, here it is - again...
Best,
Matthias
Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
---
config/menu/20-status.menu | 10 +++-
config/rootfiles/common/squid-graph | 3 ++
config/rootfiles/common/web-user-interface | 1 +
html/cgi-bin/sgraph.cgi | 72 ++++++++++++++++++++++++++
lfs/squid-graph | 81 ++++++++++++++++++++++++++++++
make.sh | 1 +
src/scripts/makegraphs | 9 +++-
7 files changed, 175 insertions(+), 2 deletions(-)
create mode 100644 config/rootfiles/common/squid-graph
create mode 100644 html/cgi-bin/sgraph.cgi
create mode 100644 lfs/squid-graph
Comments
On Wed, 2017-10-04 at 21:01 +0200, Matthias Fischer wrote:
> Hi,
>
> On 04.10.2017 18:36, Michael Tremer wrote:
> > Any screenshots?
>
> See attachment. Hope this helps.
Yes looks good.
But why is it half German and half English? Any chance we can localise the squid
graph sections?!
> Please note:
> I'd like to handle this addon as "under review", because during my
> testing of the last week I found that analysing rather LARGE squid
> access logs can last a while (here: ~15sec) and produce system loads of
> about ~15% while working.
Well, that is probably okay.
> Because of this I moved this job from 'makegraphs' (which runs every 5
> minutes) to a hourly cron job. This fits my needs and the load is ok.
How do you handle it then that the access log file is being rotated? You will
miss log lines on a busy system which isn't really what we want.
-Michael
>
> Original comment about this from squid-graphs-README:
>
> "RUNNING SQUID-GRAPH IN REAL TIME VIA THE WEB
> =============================================
>
> As of v3, Squid Graph does not support this feature anymore. If you
> would still like to do this, simply create a shell script to execute
> Squid Graph.
>
> We do not recommend this unless your log files are really small. Also,
> we did not audit Squid Graph for any possible security issues that might
> arise in an online CGI enviroment. YOU HAVE BEEN WARNED."
>
> Best,
> Matthias
>
> > Tester's feedback wanted!
> >
> > On Fri, 2017-09-29 at 08:50 +0200, Matthias Fischer wrote:
> > > This is a rather old fellow.
> > >
> > > For details see:
> > > https://sourceforge.net/projects/squid-graph/
> > >
> > > "Squid Graph is a free, simple, yet powerful Squid v2 native logfile
> > > analysis
> > > tool
> > > that generates reports with graphical representation of the proxy server's
> > > traffic,
> > > somewhat like the popular MRTG tool."
> > >
> > > I found by chance that the corresponding translation strings were still
> > > present,
> > > so I thought "Why not?". ;-)
> > >
> > > Here, it works without problems and 'squid 3.5.27'.
> > >
> > > The original 'sgraph.cgi' was slightly tuned - like in IPCop - and
> > > polished
> > > for better readability.
> > >
> > > If someone likes it, here it is - again...
> > >
> > > Best,
> > > Matthias
> > >
> > > Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
> > > ---
> > > config/menu/20-status.menu | 10 +++-
> > > config/rootfiles/common/squid-graph | 3 ++
> > > config/rootfiles/common/web-user-interface | 1 +
> > > html/cgi-bin/sgraph.cgi | 72
> > > ++++++++++++++++++++++++++
> > > lfs/squid-graph | 81
> > > ++++++++++++++++++++++++++++++
> > > make.sh | 1 +
> > > src/scripts/makegraphs | 9 +++-
> > > 7 files changed, 175 insertions(+), 2 deletions(-)
> > > create mode 100644 config/rootfiles/common/squid-graph
> > > create mode 100644 html/cgi-bin/sgraph.cgi
> > > create mode 100644 lfs/squid-graph
> > >
> > > diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu
> > > index 2bcf0d5e8..dfc6dae9b 100644
> > > --- a/config/menu/20-status.menu
> > > +++ b/config/menu/20-status.menu
> > > @@ -58,7 +58,15 @@
> > > 'title' => "$Lang::tr{'hardware
> > > graphs'}",
> > > 'enabled' => 1,
> > > };
> > > - $substatus->{'61.entropy'} = {
> > > +
> > > + $substatus->{'61.proxygraphs'} = {
> > > + 'caption' => "$Lang::tr{'ssproxy
> > > graphs'}",
> > > + 'uri' => '/cgi-bin/sgraph.cgi',
> > > + 'title' => "$Lang::tr{'ssproxy graphs'}",
> > > + 'enabled' => 1,
> > > + };
> > > +
> > > + $substatus->{'62.entropy'} = {
> > > 'caption' => "$Lang::tr{'entropy'}",
> > > 'uri' => '/cgi-bin/entropy.cgi',
> > > 'title' => "$Lang::tr{'entropy graphs'}",
> > > diff --git a/config/rootfiles/common/squid-graph
> > > b/config/rootfiles/common/squid-graph
> > > new file mode 100644
> > > index 000000000..0b558d87a
> > > --- /dev/null
> > > +++ b/config/rootfiles/common/squid-graph
> > > @@ -0,0 +1,3 @@
> > > +srv/web/ipfire/html/sgraph
> > > +srv/web/ipfire/html/sgraph/logo.png
> > > +usr/bin/squid-graph
> > > diff --git a/config/rootfiles/common/web-user-interface
> > > b/config/rootfiles/common/web-user-interface
> > > index f204f1657..b14efb402 100644
> > > --- a/config/rootfiles/common/web-user-interface
> > > +++ b/config/rootfiles/common/web-user-interface
> > > @@ -72,6 +72,7 @@ srv/web/ipfire/cgi-bin/routing.cgi
> > > #srv/web/ipfire/cgi-bin/samba.cgi
> > > #srv/web/ipfire/cgi-bin/sambahlp.cgi
> > > srv/web/ipfire/cgi-bin/services.cgi
> > > +srv/web/ipfire/cgi-bin/sgraph.cgi
> > > srv/web/ipfire/cgi-bin/shutdown.cgi
> > > srv/web/ipfire/cgi-bin/speed.cgi
> > > srv/web/ipfire/cgi-bin/system.cgi
> > > diff --git a/html/cgi-bin/sgraph.cgi b/html/cgi-bin/sgraph.cgi
> > > new file mode 100644
> > > index 000000000..dea4c068a
> > > --- /dev/null
> > > +++ b/html/cgi-bin/sgraph.cgi
> > > @@ -0,0 +1,72 @@
> > > +#!/usr/bin/perl
> > > +#########################################################################
> > > ####
> > > ##
> > > +#
> > >
> > > #
> > > +# IPFire.org - A linux based
> > > firewall #
> > > +# Copyright (C) 2016 IPFire Team <info@ipfire.org>
> > >
> > > #
> > > +#
> > >
> > > #
> > > +# This program is free software: you can redistribute it and/or
> > > modify #
> > > +# it under the terms of the GNU General Public License as published
> > > by #
> > > +# the Free Software Foundation, either version 3 of the License,
> > > or #
> > > +# (at your option) any later
> > > version. #
> > > +#
> > >
> > > #
> > > +# This program is distributed in the hope that it will be
> > > useful, #
> > > +# but WITHOUT ANY WARRANTY; without even the implied warranty
> > > of #
> > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> > > the #
> > > +# GNU General Public License for more
> > > details. #
> > > +#
> > >
> > > #
> > > +# You should have received a copy of the GNU General Public
> > > License #
> > > +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> > >
> > > #
> > > +#
> > >
> > > #
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +use strict;
> > > +
> > > +# enable only the following on debugging purpose
> > > +#use warnings;
> > > +#use CGI::Carp 'fatalsToBrowser';
> > > +
> > > +require '/var/ipfire/general-functions.pl';
> > > +require "${General::swroot}/lang.pl";
> > > +require "${General::swroot}/header.pl";
> > > +
> > > +my @graphs = ();
> > > +
> > > +&Header::showhttpheaders();
> > > +
> > > +my $dir = "/srv/web/ipfire/html/sgraph";
> > > +my $sgraphdir = "/srv/web/ipfire/html/sgraph";
> > > +
> > > +&Header::openpage($Lang::tr{'ssproxy graphs'}, 1, '');
> > > +
> > > +&Header::openbigbox('100%', 'left');
> > > +
> > > +&Header::openbox('100%', 'left', $Lang::tr{'proxy access graphs'} . ":"
> > > );
> > > +
> > > +if (open(IPACHTML, "$sgraphdir/index.html"))
> > > +{
> > > + my $skip = 1;
> > > + while (<IPACHTML>)
> > > + {
> > > + $skip = 1 if /^<HR>$/;
> > > + if ($skip)
> > > + {
> > > + $skip = 0 if /<H1>/;
> > > + next;
> > > + }
> > > + s/<IMG SRC=([^"'>]+)>/<img src='\/sgraph\/$1' alt='Graph'
> > > \/>/;
> > > + s/<HR>/<hr \/>/g;
> > > + s/<BR>/<br \/>/g;
> > > + s/<([^>]*)>/\L<$1>\E/g;
> > > + s/(size|align|border|color)=([^'"> ]+)/$1='$2'/g;
> > > + print;
> > > + }
> > > + close(IPACHTML);
> > > +}
> > > +else {
> > > + print $Lang::tr{'no information available'}; }
> > > +
> > > +&Header::closebox();
> > > +
> > > +&Header::closebigbox();
> > > +
> > > +&Header::closepage();
> > > diff --git a/lfs/squid-graph b/lfs/squid-graph
> > > new file mode 100644
> > > index 000000000..e94c0c130
> > > --- /dev/null
> > > +++ b/lfs/squid-graph
> > > @@ -0,0 +1,81 @@
> > > +#########################################################################
> > > ####
> > > ##
> > > +#
> > >
> > > #
> > > +# IPFire.org - A linux based
> > > firewall #
> > > +# Copyright (C) 2007-2015 IPFire Team <info@ipfire.org>
> > >
> > > #
> > > +#
> > >
> > > #
> > > +# This program is free software: you can redistribute it and/or
> > > modify #
> > > +# it under the terms of the GNU General Public License as published
> > > by #
> > > +# the Free Software Foundation, either version 3 of the License,
> > > or #
> > > +# (at your option) any later
> > > version. #
> > > +#
> > >
> > > #
> > > +# This program is distributed in the hope that it will be
> > > useful, #
> > > +# but WITHOUT ANY WARRANTY; without even the implied warranty
> > > of #
> > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> > > the #
> > > +# GNU General Public License for more
> > > details. #
> > > +#
> > >
> > > #
> > > +# You should have received a copy of the GNU General Public
> > > License #
> > > +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> > >
> > > #
> > > +#
> > >
> > > #
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +#########################################################################
> > > ####
> > > ##
> > > +# Definitions
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +include Config
> > > +
> > > +VER = 3.2
> > > +
> > > +THISAPP = squid-graph-$(VER)
> > > +DL_FILE = $(THISAPP).tar.gz
> > > +DL_FROM = $(URL_IPFIRE)
> > > +DIR_APP = $(DIR_SRC)/$(THISAPP)
> > > +TARGET = $(DIR_INFO)/$(THISAPP)
> > > +
> > > +#########################################################################
> > > ####
> > > ##
> > > +# Top-level Rules
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +objects = $(DL_FILE)
> > > +
> > > +$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
> > > +
> > > +$(DL_FILE)_MD5 = 89ac122a99dc2db67efbdcd2467b9939
> > > +
> > > +install : $(TARGET)
> > > +
> > > +check : $(patsubst %,$(DIR_CHK)/%,$(objects))
> > > +
> > > +download :$(patsubst %,$(DIR_DL)/%,$(objects))
> > > +
> > > +md5 : $(subst %,%_MD5,$(objects))
> > > +
> > > +#########################################################################
> > > ####
> > > ##
> > > +# Downloading, checking, md5sum
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +$(patsubst %,$(DIR_CHK)/%,$(objects)) :
> > > + @$(CHECK)
> > > +
> > > +$(patsubst %,$(DIR_DL)/%,$(objects)) :
> > > + @$(LOAD)
> > > +
> > > +$(subst %,%_MD5,$(objects)) :
> > > + @$(MD5)
> > > +
> > > +#########################################################################
> > > ####
> > > ##
> > > +# Installation Details
> > > +#########################################################################
> > > ####
> > > ##
> > > +
> > > +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
> > > + @$(PREBUILD)
> > > + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf
> > > $(DIR_DL)/$(DL_FILE)
> > > +
> > > + cp -f $(DIR_SRC)/squid-graph/squid-graph /usr/bin/squid-graph
> > > + chmod 755 /usr/bin/squid-graph
> > > +
> > > + -mkdir -p /srv/web/ipfire/html/sgraph
> > > + cp -f $(DIR_SRC)/squid-graph/logo.png /srv/web/ipfire/html/sgraph
> > > +
> > > + @rm -rf $(DIR_APP)
> > > + @$(POSTBUILD)
> > > diff --git a/make.sh b/make.sh
> > > index 815b25aca..eac4b229f 100755
> > > --- a/make.sh
> > > +++ b/make.sh
> > > @@ -638,6 +638,7 @@ buildipfire() {
> > > lfsmake2 snort
> > > lfsmake2 oinkmaster
> > > lfsmake2 squid
> > > + lfsmake2 squid-graph
> > > lfsmake2 squidguard
> > > lfsmake2 calamaris
> > > lfsmake2 tcpdump
> > > diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs
> > > index 0b56b9325..0191ef70b 100644
> > > --- a/src/scripts/makegraphs
> > > +++ b/src/scripts/makegraphs
> > > @@ -79,7 +79,7 @@ sub updatehdddata{
> > > print "Error in RRD::create for hdd-".$array[$#array].":
> > > $ERROR\n" if $ERROR;
> > > }
> > >
> > > - # Temperaturlesen w�rde die Platte aufwecken!!!
> > > + # Temperaturlesen würde die Platte aufwecken!!!
> > > if (!$standby){
> > > $temp = 0;
> > > my $smart_output = '';
> > > @@ -134,3 +134,10 @@ foreach (@disks){
> > >
> > > updatehdddata($disk);
> > > }
> > > +
> > > +###
> > > +### Squid Graphs
> > > +###
> > > +if ( -e "/var/log/squid/access.log" ) {
> > > + system ("/usr/bin/squid-graph --no-console-log --tcp-only --
> > > output-
> > > dir=/srv/web/ipfire/html/sgraph < /var/log/squid/access.log >/dev/null
> > > 2>&1");
> > > +}
>
>
Hi,
On 09.10.2017 16:28, Michael Tremer wrote:
> On Wed, 2017-10-04 at 21:01 +0200, Matthias Fischer wrote:
>> Hi,
>>
>> On 04.10.2017 18:36, Michael Tremer wrote:
>> > Any screenshots?
>>
>> See attachment. Hope this helps.
>
> Yes looks good.
>
> But why is it half German and half English? Any chance we can localise the squid
> graph sections?!
This is done through 'squid-graph.cgi'. I'll take a look...
>> Please note:
>> I'd like to handle this addon as "under review", because during my
>> testing of the last week I found that analysing rather LARGE squid
>> access logs can last a while (here: ~15sec) and produce system loads of
>> about ~15% while working.
>
> Well, that is probably okay.
Well...then... I wasn't sure. ;-)
>> Because of this I moved this job from 'makegraphs' (which runs every 5
>> minutes) to a hourly cron job. This fits my needs and the load is ok.
>
> How do you handle it then that the access log file is being rotated? You will
> miss log lines on a busy system which isn't really what we want.
Yep. As I wrote, this was only for testing. At the time, I had about 1.5
million lines in 'access.log' and wasn't sure how this would be handled.
See original comment below.
I'll try a translation and will report.
Best,
Matthias
>
> -Michael
>
>>
>> Original comment about this from squid-graphs-README:
>>
>> "RUNNING SQUID-GRAPH IN REAL TIME VIA THE WEB
>> =============================================
>>
>> As of v3, Squid Graph does not support this feature anymore. If you
>> would still like to do this, simply create a shell script to execute
>> Squid Graph.
>>
>> We do not recommend this unless your log files are really small. Also,
>> we did not audit Squid Graph for any possible security issues that might
>> arise in an online CGI enviroment. YOU HAVE BEEN WARNED."
>>
>> Best,
>> Matthias
>>
>> > Tester's feedback wanted!
>> >
>> > On Fri, 2017-09-29 at 08:50 +0200, Matthias Fischer wrote:
>> > > This is a rather old fellow.
>> > >
>> > > For details see:
>> > > https://sourceforge.net/projects/squid-graph/
>> > >
>> > > "Squid Graph is a free, simple, yet powerful Squid v2 native logfile
>> > > analysis
>> > > tool
>> > > that generates reports with graphical representation of the proxy server's
>> > > traffic,
>> > > somewhat like the popular MRTG tool."
>> > >
>> > > I found by chance that the corresponding translation strings were still
>> > > present,
>> > > so I thought "Why not?". ;-)
>> > >
>> > > Here, it works without problems and 'squid 3.5.27'.
>> > >
>> > > The original 'sgraph.cgi' was slightly tuned - like in IPCop - and
>> > > polished
>> > > for better readability.
>> > >
>> > > If someone likes it, here it is - again...
>> > >
>> > > Best,
>> > > Matthias
>> > >
>> > > Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
>> > > ---
>> > > config/menu/20-status.menu | 10 +++-
>> > > config/rootfiles/common/squid-graph | 3 ++
>> > > config/rootfiles/common/web-user-interface | 1 +
>> > > html/cgi-bin/sgraph.cgi | 72
>> > > ++++++++++++++++++++++++++
>> > > lfs/squid-graph | 81
>> > > ++++++++++++++++++++++++++++++
>> > > make.sh | 1 +
>> > > src/scripts/makegraphs | 9 +++-
>> > > 7 files changed, 175 insertions(+), 2 deletions(-)
>> > > create mode 100644 config/rootfiles/common/squid-graph
>> > > create mode 100644 html/cgi-bin/sgraph.cgi
>> > > create mode 100644 lfs/squid-graph
>> > >
>> > > diff --git a/config/menu/20-status.menu b/config/menu/20-status.menu
>> > > index 2bcf0d5e8..dfc6dae9b 100644
>> > > --- a/config/menu/20-status.menu
>> > > +++ b/config/menu/20-status.menu
>> > > @@ -58,7 +58,15 @@
>> > > 'title' => "$Lang::tr{'hardware
>> > > graphs'}",
>> > > 'enabled' => 1,
>> > > };
>> > > - $substatus->{'61.entropy'} = {
>> > > +
>> > > + $substatus->{'61.proxygraphs'} = {
>> > > + 'caption' => "$Lang::tr{'ssproxy
>> > > graphs'}",
>> > > + 'uri' => '/cgi-bin/sgraph.cgi',
>> > > + 'title' => "$Lang::tr{'ssproxy graphs'}",
>> > > + 'enabled' => 1,
>> > > + };
>> > > +
>> > > + $substatus->{'62.entropy'} = {
>> > > 'caption' => "$Lang::tr{'entropy'}",
>> > > 'uri' => '/cgi-bin/entropy.cgi',
>> > > 'title' => "$Lang::tr{'entropy graphs'}",
>> > > diff --git a/config/rootfiles/common/squid-graph
>> > > b/config/rootfiles/common/squid-graph
>> > > new file mode 100644
>> > > index 000000000..0b558d87a
>> > > --- /dev/null
>> > > +++ b/config/rootfiles/common/squid-graph
>> > > @@ -0,0 +1,3 @@
>> > > +srv/web/ipfire/html/sgraph
>> > > +srv/web/ipfire/html/sgraph/logo.png
>> > > +usr/bin/squid-graph
>> > > diff --git a/config/rootfiles/common/web-user-interface
>> > > b/config/rootfiles/common/web-user-interface
>> > > index f204f1657..b14efb402 100644
>> > > --- a/config/rootfiles/common/web-user-interface
>> > > +++ b/config/rootfiles/common/web-user-interface
>> > > @@ -72,6 +72,7 @@ srv/web/ipfire/cgi-bin/routing.cgi
>> > > #srv/web/ipfire/cgi-bin/samba.cgi
>> > > #srv/web/ipfire/cgi-bin/sambahlp.cgi
>> > > srv/web/ipfire/cgi-bin/services.cgi
>> > > +srv/web/ipfire/cgi-bin/sgraph.cgi
>> > > srv/web/ipfire/cgi-bin/shutdown.cgi
>> > > srv/web/ipfire/cgi-bin/speed.cgi
>> > > srv/web/ipfire/cgi-bin/system.cgi
>> > > diff --git a/html/cgi-bin/sgraph.cgi b/html/cgi-bin/sgraph.cgi
>> > > new file mode 100644
>> > > index 000000000..dea4c068a
>> > > --- /dev/null
>> > > +++ b/html/cgi-bin/sgraph.cgi
>> > > @@ -0,0 +1,72 @@
>> > > +#!/usr/bin/perl
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +#
>> > >
>> > > #
>> > > +# IPFire.org - A linux based
>> > > firewall #
>> > > +# Copyright (C) 2016 IPFire Team <info@ipfire.org>
>> > >
>> > > #
>> > > +#
>> > >
>> > > #
>> > > +# This program is free software: you can redistribute it and/or
>> > > modify #
>> > > +# it under the terms of the GNU General Public License as published
>> > > by #
>> > > +# the Free Software Foundation, either version 3 of the License,
>> > > or #
>> > > +# (at your option) any later
>> > > version. #
>> > > +#
>> > >
>> > > #
>> > > +# This program is distributed in the hope that it will be
>> > > useful, #
>> > > +# but WITHOUT ANY WARRANTY; without even the implied warranty
>> > > of #
>> > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
>> > > the #
>> > > +# GNU General Public License for more
>> > > details. #
>> > > +#
>> > >
>> > > #
>> > > +# You should have received a copy of the GNU General Public
>> > > License #
>> > > +# along with this program. If not, see <http://www.gnu.org/licenses/>.
>> > >
>> > > #
>> > > +#
>> > >
>> > > #
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +use strict;
>> > > +
>> > > +# enable only the following on debugging purpose
>> > > +#use warnings;
>> > > +#use CGI::Carp 'fatalsToBrowser';
>> > > +
>> > > +require '/var/ipfire/general-functions.pl';
>> > > +require "${General::swroot}/lang.pl";
>> > > +require "${General::swroot}/header.pl";
>> > > +
>> > > +my @graphs = ();
>> > > +
>> > > +&Header::showhttpheaders();
>> > > +
>> > > +my $dir = "/srv/web/ipfire/html/sgraph";
>> > > +my $sgraphdir = "/srv/web/ipfire/html/sgraph";
>> > > +
>> > > +&Header::openpage($Lang::tr{'ssproxy graphs'}, 1, '');
>> > > +
>> > > +&Header::openbigbox('100%', 'left');
>> > > +
>> > > +&Header::openbox('100%', 'left', $Lang::tr{'proxy access graphs'} . ":"
>> > > );
>> > > +
>> > > +if (open(IPACHTML, "$sgraphdir/index.html"))
>> > > +{
>> > > + my $skip = 1;
>> > > + while (<IPACHTML>)
>> > > + {
>> > > + $skip = 1 if /^<HR>$/;
>> > > + if ($skip)
>> > > + {
>> > > + $skip = 0 if /<H1>/;
>> > > + next;
>> > > + }
>> > > + s/<IMG SRC=([^"'>]+)>/<img src='\/sgraph\/$1' alt='Graph'
>> > > \/>/;
>> > > + s/<HR>/<hr \/>/g;
>> > > + s/<BR>/<br \/>/g;
>> > > + s/<([^>]*)>/\L<$1>\E/g;
>> > > + s/(size|align|border|color)=([^'"> ]+)/$1='$2'/g;
>> > > + print;
>> > > + }
>> > > + close(IPACHTML);
>> > > +}
>> > > +else {
>> > > + print $Lang::tr{'no information available'}; }
>> > > +
>> > > +&Header::closebox();
>> > > +
>> > > +&Header::closebigbox();
>> > > +
>> > > +&Header::closepage();
>> > > diff --git a/lfs/squid-graph b/lfs/squid-graph
>> > > new file mode 100644
>> > > index 000000000..e94c0c130
>> > > --- /dev/null
>> > > +++ b/lfs/squid-graph
>> > > @@ -0,0 +1,81 @@
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +#
>> > >
>> > > #
>> > > +# IPFire.org - A linux based
>> > > firewall #
>> > > +# Copyright (C) 2007-2015 IPFire Team <info@ipfire.org>
>> > >
>> > > #
>> > > +#
>> > >
>> > > #
>> > > +# This program is free software: you can redistribute it and/or
>> > > modify #
>> > > +# it under the terms of the GNU General Public License as published
>> > > by #
>> > > +# the Free Software Foundation, either version 3 of the License,
>> > > or #
>> > > +# (at your option) any later
>> > > version. #
>> > > +#
>> > >
>> > > #
>> > > +# This program is distributed in the hope that it will be
>> > > useful, #
>> > > +# but WITHOUT ANY WARRANTY; without even the implied warranty
>> > > of #
>> > > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
>> > > the #
>> > > +# GNU General Public License for more
>> > > details. #
>> > > +#
>> > >
>> > > #
>> > > +# You should have received a copy of the GNU General Public
>> > > License #
>> > > +# along with this program. If not, see <http://www.gnu.org/licenses/>.
>> > >
>> > > #
>> > > +#
>> > >
>> > > #
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +# Definitions
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +include Config
>> > > +
>> > > +VER = 3.2
>> > > +
>> > > +THISAPP = squid-graph-$(VER)
>> > > +DL_FILE = $(THISAPP).tar.gz
>> > > +DL_FROM = $(URL_IPFIRE)
>> > > +DIR_APP = $(DIR_SRC)/$(THISAPP)
>> > > +TARGET = $(DIR_INFO)/$(THISAPP)
>> > > +
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +# Top-level Rules
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +objects = $(DL_FILE)
>> > > +
>> > > +$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
>> > > +
>> > > +$(DL_FILE)_MD5 = 89ac122a99dc2db67efbdcd2467b9939
>> > > +
>> > > +install : $(TARGET)
>> > > +
>> > > +check : $(patsubst %,$(DIR_CHK)/%,$(objects))
>> > > +
>> > > +download :$(patsubst %,$(DIR_DL)/%,$(objects))
>> > > +
>> > > +md5 : $(subst %,%_MD5,$(objects))
>> > > +
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +# Downloading, checking, md5sum
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +$(patsubst %,$(DIR_CHK)/%,$(objects)) :
>> > > + @$(CHECK)
>> > > +
>> > > +$(patsubst %,$(DIR_DL)/%,$(objects)) :
>> > > + @$(LOAD)
>> > > +
>> > > +$(subst %,%_MD5,$(objects)) :
>> > > + @$(MD5)
>> > > +
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +# Installation Details
>> > > +#########################################################################
>> > > ####
>> > > ##
>> > > +
>> > > +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
>> > > + @$(PREBUILD)
>> > > + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf
>> > > $(DIR_DL)/$(DL_FILE)
>> > > +
>> > > + cp -f $(DIR_SRC)/squid-graph/squid-graph /usr/bin/squid-graph
>> > > + chmod 755 /usr/bin/squid-graph
>> > > +
>> > > + -mkdir -p /srv/web/ipfire/html/sgraph
>> > > + cp -f $(DIR_SRC)/squid-graph/logo.png /srv/web/ipfire/html/sgraph
>> > > +
>> > > + @rm -rf $(DIR_APP)
>> > > + @$(POSTBUILD)
>> > > diff --git a/make.sh b/make.sh
>> > > index 815b25aca..eac4b229f 100755
>> > > --- a/make.sh
>> > > +++ b/make.sh
>> > > @@ -638,6 +638,7 @@ buildipfire() {
>> > > lfsmake2 snort
>> > > lfsmake2 oinkmaster
>> > > lfsmake2 squid
>> > > + lfsmake2 squid-graph
>> > > lfsmake2 squidguard
>> > > lfsmake2 calamaris
>> > > lfsmake2 tcpdump
>> > > diff --git a/src/scripts/makegraphs b/src/scripts/makegraphs
>> > > index 0b56b9325..0191ef70b 100644
>> > > --- a/src/scripts/makegraphs
>> > > +++ b/src/scripts/makegraphs
>> > > @@ -79,7 +79,7 @@ sub updatehdddata{
>> > > print "Error in RRD::create for hdd-".$array[$#array].":
>> > > $ERROR\n" if $ERROR;
>> > > }
>> > >
>> > > - # Temperaturlesen w�rde die Platte aufwecken!!!
>> > > + # Temperaturlesen würde die Platte aufwecken!!!
>> > > if (!$standby){
>> > > $temp = 0;
>> > > my $smart_output = '';
>> > > @@ -134,3 +134,10 @@ foreach (@disks){
>> > >
>> > > updatehdddata($disk);
>> > > }
>> > > +
>> > > +###
>> > > +### Squid Graphs
>> > > +###
>> > > +if ( -e "/var/log/squid/access.log" ) {
>> > > + system ("/usr/bin/squid-graph --no-console-log --tcp-only --
>> > > output-
>> > > dir=/srv/web/ipfire/html/sgraph < /var/log/squid/access.log >/dev/null
>> > > 2>&1");
>> > > +}
>>
>>
>
Hi,
On 09.10.2017 16:28, Michael Tremer wrote:
> But why is it half German and half English? Any chance we can localise the squid
> graph sections?!
> ...
Done.
Localization was easy, but now I'm taking a few days off (from
22.2.17-6.11.17 => 54° 43′ N, 8° 24′ O). ;-))
So it would be really nice if someone would check the translations and
give his/her(?) OK for that, before I push this (Language files are
attached).
Best,
Matthias
%tr = (
%tr,
'24hseconds' => '86400 Sekunden',
'analysis duration' => 'Analyse - Dauer',
'analysis speed' => 'Analyse - Geschwindigkeit',
'average accesses' => 'Zugriffe - Durchschnitt',
'average cache hits' => 'Cache-Treffer - Durchschnitt',
'average cache ims hits' => 'Cache-Treffer - IMS-Durchschnitt',
'average cache misses' => 'Cache verfehlt - Durchschnitt',
'average transfers' => 'Transfers - Durchschnitt',
'avg cache hit duration' => 'Cache-Dauer (Treffer)',
'avg cache miss duration' => 'Cache-Dauer (verfehlt)',
'avg transfer duration' => 'Transfer-Dauer',
'cumulative graph of tcp accesses' => 'Diagramm der TCP-Zugriffe (Zusammenfassung)',
'cumulative graph of tcp transfers' => 'Diagramm der TCP-Transfers (Zusammenfassung)',
'cumulative graph of udp accesses' => 'Diagramm der UDP-Zugriffe (Zusammenfassung)',
'cumulative graph of udp transfers' => 'Diagramm der UDP-Transfers (Zusammenfassung)',
'errors' => 'Fehler',
'generated' => 'Erstellt',
'graph domain' => 'Diagramm - Zeitraum',
'graph end' => 'Diagramm - Ende',
'graph of average tcp transfer duration' => 'Diagramm der TCP-Transfer-Dauer (Durchschnitt)',
'graph of average udp transfer duration' => 'Diagramm der UDP-Transfer-Dauer (Durchschnitt)',
'graph of tcp accesses' => 'Diagramm der TCP-Zugriffe (alle 5 Minuten)',
'graph of tcp transfers' => 'Diagramm der TCP-Transfers (alle 5 Minuten)',
'graph of udp accesses' => 'Diagramm der UDP-Zugriffe (alle 5 Minuten)',
'graph of udp transfers' => 'Diagramm der UDP-Transfers (alle 5 Minuten)',
'graph start' => 'Diagramm - Start',
'hours' => 'Stunden',
'lines analyzed' => 'Analysierte Zeilen<br />(access.log)',
'lines sec' => 'Zeilen/Sekunde',
'lines' => 'Zeilen',
'percent cache hits' => 'Cache-Treffer - Prozent',
'percent cache misses' => 'Cache verfehlt - Prozent',
'per hour' => 'pro Stunde',
'proxy access graphs' => 'Diagramme zur Proxyauslastung',
'seconds' => 'Sekunde(n)',
'ssproxy graphs' => 'Proxy-Diagramme',
'total accesses' => 'Zugriffe - gesamt',
'total cache hits' => 'Cache-Treffer - gesamt',
'total cache ims hits' => 'Cache-Treffer - IMS gesamt',
'total cache misses' => 'Cache verfehlt - gesamt',
'total transfers' => 'Transfers - gesamt',
);
#EOF
%tr = (
%tr,
'24hseconds' => '86400 seconds',
'analysis duration' => 'Analysis Duration',
'analysis speed' => 'Analysis Speed',
'average accesses' => 'Average Accesses',
'average cache hits' => 'Average Cache Hits',
'average cache ims hits' => 'Average Cache IMS Hits',
'average cache misses' => 'Average Cache Misses',
'average transfers' => 'Average Transfers',
'avg cache hit duration' => 'Avg. Cache Hit Duration',
'avg cache miss duration' => 'Avg. Cache Miss Duration',
'avg transfer duration' => 'Avg. Transfer Duration',
'cumulative graph of tcp accesses' => 'Cumulative graph of TCP Accesses',
'cumulative graph of tcp transfers' => 'Cumulative graph of TCP Transfers',
'cumulative graph of udp accesses' => 'Cumulative graph of UDP Accesses',
'cumulative graph of udp transfers' => 'Cumulative graph of UDP Transfers',
'errors' => 'error(s)',
'generated' => 'Generated',
'graph domain' => 'Graph Domain',
'graph end' => 'Graph End',
'graph of average tcp transfer duration' => 'Graph of Average TCP Transfer Duration',
'graph of average udp transfer duration' => 'Graph of Average UDP Transfer Duration',
'graph of tcp accesses' => 'Graph of TCP Accesses (5 minute total)',
'graph of tcp transfers' => 'Graph of TCP Transfers (5 minute total)',
'graph of udp accesses' => 'Graph of UDP Accesses (5 minute total)',
'graph of udp transfers' => 'Graph of UDP Transfers (5 minute total)',
'graph start' => 'Graph Start',
'hours' => 'hours',
'lines analyzed' => 'Lines analyzed<br />(access.log)',
'lines sec' => 'lines/sec',
'lines' => 'lines',
'percent cache hits' => '% Cache Hits',
'percent cache misses' => '% Cache Misses',
'per hour' => 'per hour',
'proxy access graphs' => 'Proxy access graphs',
'seconds' => 'second(s)',
'ssproxy graphs' => 'Proxy Graphs',
'total accesses' => 'Total Accesses',
'total cache hits' => 'Total Cache Hits',
'total cache ims hits' => 'Total Cache IMS Hits',
'total cache misses' => 'Total Cache Misses',
'total transfers' => 'Total Transfers',
);
#EOF
Hi,
On Fri, 2017-10-20 at 18:43 +0200, Matthias Fischer wrote:
> Hi,
>
> On 09.10.2017 16:28, Michael Tremer wrote:
> > But why is it half German and half English? Any chance we can localise the
> > squid
> > graph sections?!
> > ...
>
> Done.
>
> Localization was easy, but now I'm taking a few days off (from
> 22.2.17-6.11.17 => 54° 43′ N, 8° 24′ O). ;-))
Have a nice holiday!
> So it would be really nice if someone would check the translations and
> give his/her(?) OK for that, before I push this (Language files are
> attached).
Both are okay I think.
>
> Best,
> Matthias
-Michael
@@ -58,7 +58,15 @@
'title' => "$Lang::tr{'hardware graphs'}",
'enabled' => 1,
};
- $substatus->{'61.entropy'} = {
+
+ $substatus->{'61.proxygraphs'} = {
+ 'caption' => "$Lang::tr{'ssproxy graphs'}",
+ 'uri' => '/cgi-bin/sgraph.cgi',
+ 'title' => "$Lang::tr{'ssproxy graphs'}",
+ 'enabled' => 1,
+ };
+
+ $substatus->{'62.entropy'} = {
'caption' => "$Lang::tr{'entropy'}",
'uri' => '/cgi-bin/entropy.cgi',
'title' => "$Lang::tr{'entropy graphs'}",
new file mode 100644
@@ -0,0 +1,3 @@
+srv/web/ipfire/html/sgraph
+srv/web/ipfire/html/sgraph/logo.png
+usr/bin/squid-graph
@@ -72,6 +72,7 @@ srv/web/ipfire/cgi-bin/routing.cgi
#srv/web/ipfire/cgi-bin/samba.cgi
#srv/web/ipfire/cgi-bin/sambahlp.cgi
srv/web/ipfire/cgi-bin/services.cgi
+srv/web/ipfire/cgi-bin/sgraph.cgi
srv/web/ipfire/cgi-bin/shutdown.cgi
srv/web/ipfire/cgi-bin/speed.cgi
srv/web/ipfire/cgi-bin/system.cgi
new file mode 100644
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2016 IPFire Team <info@ipfire.org> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my @graphs = ();
+
+&Header::showhttpheaders();
+
+my $dir = "/srv/web/ipfire/html/sgraph";
+my $sgraphdir = "/srv/web/ipfire/html/sgraph";
+
+&Header::openpage($Lang::tr{'ssproxy graphs'}, 1, '');
+
+&Header::openbigbox('100%', 'left');
+
+&Header::openbox('100%', 'left', $Lang::tr{'proxy access graphs'} . ":" );
+
+if (open(IPACHTML, "$sgraphdir/index.html"))
+{
+ my $skip = 1;
+ while (<IPACHTML>)
+ {
+ $skip = 1 if /^<HR>$/;
+ if ($skip)
+ {
+ $skip = 0 if /<H1>/;
+ next;
+ }
+ s/<IMG SRC=([^"'>]+)>/<img src='\/sgraph\/$1' alt='Graph' \/>/;
+ s/<HR>/<hr \/>/g;
+ s/<BR>/<br \/>/g;
+ s/<([^>]*)>/\L<$1>\E/g;
+ s/(size|align|border|color)=([^'"> ]+)/$1='$2'/g;
+ print;
+ }
+ close(IPACHTML);
+}
+else {
+ print $Lang::tr{'no information available'}; }
+
+&Header::closebox();
+
+&Header::closebigbox();
+
+&Header::closepage();
new file mode 100644
@@ -0,0 +1,81 @@
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007-2015 IPFire Team <info@ipfire.org> #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+VER = 3.2
+
+THISAPP = squid-graph-$(VER)
+DL_FILE = $(THISAPP).tar.gz
+DL_FROM = $(URL_IPFIRE)
+DIR_APP = $(DIR_SRC)/$(THISAPP)
+TARGET = $(DIR_INFO)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_MD5 = 89ac122a99dc2db67efbdcd2467b9939
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+md5 : $(subst %,%_MD5,$(objects))
+
+###############################################################################
+# Downloading, checking, md5sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+ @$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+ @$(LOAD)
+
+$(subst %,%_MD5,$(objects)) :
+ @$(MD5)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+ @$(PREBUILD)
+ @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
+
+ cp -f $(DIR_SRC)/squid-graph/squid-graph /usr/bin/squid-graph
+ chmod 755 /usr/bin/squid-graph
+
+ -mkdir -p /srv/web/ipfire/html/sgraph
+ cp -f $(DIR_SRC)/squid-graph/logo.png /srv/web/ipfire/html/sgraph
+
+ @rm -rf $(DIR_APP)
+ @$(POSTBUILD)
@@ -638,6 +638,7 @@ buildipfire() {
lfsmake2 snort
lfsmake2 oinkmaster
lfsmake2 squid
+ lfsmake2 squid-graph
lfsmake2 squidguard
lfsmake2 calamaris
lfsmake2 tcpdump
@@ -79,7 +79,7 @@ sub updatehdddata{
print "Error in RRD::create for hdd-".$array[$#array].": $ERROR\n" if $ERROR;
}
- # Temperaturlesen w�rde die Platte aufwecken!!!
+ # Temperaturlesen würde die Platte aufwecken!!!
if (!$standby){
$temp = 0;
my $smart_output = '';
@@ -134,3 +134,10 @@ foreach (@disks){
updatehdddata($disk);
}
+
+###
+### Squid Graphs
+###
+if ( -e "/var/log/squid/access.log" ) {
+ system ("/usr/bin/squid-graph --no-console-log --tcp-only --output-dir=/srv/web/ipfire/html/sgraph < /var/log/squid/access.log >/dev/null 2>&1");
+}