From: Matthias Fischer <matthias.fischer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [PATCH] squid-graph 3.2: Proxy Graphs rebuilt (V2)
Date: Mon, 09 Oct 2017 20:19:51 +0200 [thread overview]
Message-ID: <0723214a-0c65-b86c-8a19-a9a8270e12e0@ipfire.org> (raw)
In-Reply-To: <1507559329.4045.18.camel@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 15142 bytes --]
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(a)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(a)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(a)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");
>> > > +}
>>
>>
>
next prev parent reply other threads:[~2017-10-09 18:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <62cb9412-59bd-233e-b9fd-f60d46bc5013@ipfire.org>
2017-10-09 14:28 ` Michael Tremer
2017-10-09 18:19 ` Matthias Fischer [this message]
2017-10-20 16:43 ` Matthias Fischer
2017-10-23 14:29 ` Michael Tremer
2017-09-29 6:50 Matthias Fischer
2017-10-04 16:36 ` Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0723214a-0c65-b86c-8a19-a9a8270e12e0@ipfire.org \
--to=matthias.fischer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox