Para funcionar o SqStat, tem que estar dentro do seu Apache ou outro Web Server de sua preferência, para poder ser acessado via WEB e ver os acessos em tempo real.
Para implementar o SqStat nas versões novas (3+) do Squid, tem que ser aplicado um patch. Vamos fazer o download do SqStat, primeiro:
Renomeie o arquivo config.inc.php.defaults para config.inc.php:
# mv config.inc.php.defaults config.inc.php
Edite o arquivo config.inc.php. Deixe da maneira que vai estar abaixo, de acordo com suas configurações:
# vi config.inc.php
<?php
/* global settings */
$use_js=true; // use javascript for the HTML toolkits
// Maximum URL length to display in URI table column
DEFINE("SQSTAT_SHOWLEN",60);
/* proxy settings */
/* Squid proxy server ip address or host name */
$squidhost[0]="192.168.0.1";
/* Squid proxy server port */
$squidport[0]=3128;
/* cachemgr_passwd in squid.conf. Leave blank to disable authorisation */
$cachemgr_passwd[0]="";
/* Resolve user IP addresses or print them as numbers only [true|false] */
$resolveip[0]=false;
/* uncomment next line if you want to use hosts-like file.
See hosts.txt.dist. */ // $hosts_file[0]="hosts.txt"
/* Group users by hostname - "host" or by User - "username". Username work only
with squid 2.6+ */
$group_by[0]="username";
/* you can specify more than one proxy in the configuration file, e.g.: */ // $squidhost[1]="192.168.0.2";
// $squidport[1]=3129;
// $cachemgr_passwd[1]="secret";
// $resolveip[1]=true;
// $hosts_file[1]="otherhosts.txt"
?>
Agora no squid.conf, adicione essa linha:
acl webserver src 192.168.0.1/32 # Mude para o IP do seu servidor
http_access allow manager localhost
http_access allow manager webserver
http_access deny manager
Depois disso, é só autenticar no Squid via NTLM e ver o SqStat monitorar em tempo real os acessos dos usuários.
$use_js=true; // use javascript for the HTML toolkits
// Maximum URL length to display in URI table column
DEFINE("SQSTAT_SHOWLEN",60);
/* proxy settings */
/* Squid proxy server ip address or host name */
$squidhost[0]="192.168.50.40";
/* Squid proxy server port */
$squidport[0]=3128;
/* cachemgr_passwd in squid.conf. Leave blank to disable authorisation */
$cachemgr_passwd[0]="";
/* Resolve user IP addresses or print them as numbers only [true|false] */
$resolveip[0]=true;
/* uncomment next line if you want to use hosts-like file.
See hosts.txt.dist. */
//$hosts_file[0]="hosts.txt"
/* Group users by hostname - "host" or by User - "username". Username work only
with squid 2.6+ */
$group_by[0]="username";
/* you can specify more than one proxy in the configuration file, e.g.: */
// $squidhost[1]="192.168.0.2";
// $squidport[1]=3129;
// $cachemgr_passwd[1]="secret";
// $resolveip[1]=true;
// $hosts_file[1]="otherhosts.txt"
#Libera acesso ao webserver local sem autenticação para deny_info do squid
acl servidor dst 192.168.0.1
no_cache deny servidor
http_access allow servidor