Everyone who raises a proxy, then wants to see who uses it, who shakes so much. And sometimes it is very useful to view in real time who shakes what. In this topic will be considered the following programs:
SqStat - Real Time statistics via web
Sarg - Squid log analyzer with subsequent HTML generation
SquidView - Interactive console log monitor Squid
0. Introduction
I will not tell here how to configure Apache. In the internet there are so many manuals on this topic, so go ahead and with the song, I will talk about the features that I have implemented.
Yes, I’ll tell on the example of Debian Etch, your paths may differ, keep in mind ...
Go…
')
1. SquidView
This program works in the console, and displays everything Squid does there.
Installation:
aptitude install squidview
Let's wait a couple of seconds if you have fast internet. Everything, now we can look who that shakes. If you did not change the location of the logs, and left most of the squid parameters defaulted, then you only need to run it to view, but with root rights, because the squid logs are written to them ...
sudo squidview
I think that this is quite enough for you, but I will also tell you very useful things, you need to press the buttons, and watch:
- h - help, here we can learn even more;)
- l - enter - report generation, you can also configure advanced settings
- T - starts accounting statistics on the size of the downloaded
- O - viewing who shook by users, after T
By SquidView, everything seems to be, if something is not told, write, add!
2. SqStat

This is a script that allows you to watch active connections, channel load, and average channel load.
I assume that you already have an apache.
Download the latest version,
wget -c samm.kiev.ua/sqstat/sqstat-1.20.tar.gz
tar xvfz sqstat-1.20.tar.gz
cd ./sqstat-1.20
mkdir /var/www/squid-stat
cp -R * /var/www/squid-stat*
Everything, now we need to configure Squid-cgi or cachemgr.cgi, We put:
aptitude install squid-cgi
Now you need to configure access ...
nano /etc/squid/squid.conf
Add
acl manager proto cache_object
http_access allow manager localhost
http_access deny manager
# secret
cachemgr_passwd secret all
Now you need to fix /etc/squid/cachemgr.conf
echo "*" >> /etc/squid/cachemgr.conf
Instead of * you can put the network address that squid listens on
Here vrodeby and all!
http: //localhost/cgi-bin/cachemgr.cgiFor some reason, I could not start at the address 127.0.0.1 and entered 192.168.0.1 and it all worked. Now you need to enter the external network address in the Cache Host field. What is your port, in the login field, if you did everything on the manual, you can not drive anything, and in the password field write the secret. If everything went well, then you will see a list of available parameters ... You can see, and we are going to configure SqStat ...
nano /var/www/squid-stat/config.inc.php
//
$squidhost[0]="192.168.0.1";
$squidport[0]=3128;
$cachemgr_passwd[0]="secret";
//
$resolveip[0]=false;
// , :)
$hosts_file[0]="hosts";
$group_by[0]="host";
In principle, the config itself is well documented, study, since there is nothing to learn there))
Now we do a subdomain, so much more convenient)
nano /etc/apache2/sites-enabled/sqstat
<VirtualHost squid.server.local:80>
ServerAdmin squid@gmail.com
DocumentRoot /var/www/squid-stat/
ServerName proxy.server.local
For rezolving write in / etc / hosts
nano /etc/hosts
192.168.0.1 proxy.server.local
That's all :) almost all
squid -k reconfigure
/etc/init.d/apache2 reload
3. Sarg
This program generates html reports, draws graphics, and so on ...
We put:
aptitude install sarg
nano /etc/squid/sarg.conf
language Russian_koi8
graphs yes
title "Squid User Access Reports"
temporary_dir /tmp
output_dir /var/www/sarg
max_elapsed 28800000
charset Koi8-r
Of course, no one forbids you to indulge in the style of displaying the entire economy - the config is provided with very detailed comments.
crontab -u root -e
* 08-18/1 * * * /usr/sbin/sarg-reports today
* 00 * * * /usr/sbin/sarg-reports daily
* 01 * * 1 /usr/sbin/sarg-reports weekly
* 02 1 * * /usr/sbin/sarg-reports monthly
Epilogue
Everything :)) If you want, you can create a subdomain for it! This is already described ...
I myself use all three programs and am satisfied.
UPD. To solve the problem with skivdom 3rd version, you need to make a soft link:
ln -s /var/log/squid3/access.log /root/.squidview/log1
UPD.2. The next article will talk about
delay poolsCrosspost from my blog