PermLUG |
Пермская группа пользователей Linux |
|
|
|
||
Вход в систему |
Контролируем мгновенную загруженность канала SQUID
Fellah, 11.12.2009 — 10:41
Хотите организовать Linux прокси-сервер - ваш выбор SQUID. Не смотря на полноту настроек и возможностей связки SAMS+SQUID, порой не достает мгновенного мониторинга интернет-канала на текущую загрузку. Бывает полезно узнать, какой ковбой забил половину канала, от чёго другие пользователи могут не получать необходимой скорости, либо просто узнать, насколько используется ширина канала связи.
Всё, что необходимо, это:
Устанавливаем так:
Наслаждаемся результатом :) |
Тэги в ТегиНовые записи в блогах
Активные обсуждения форума
Новости Linux
|
| Пермская группа пользователей Linux, 2003—2011 | ||
Придирка по оформлению: скриншотец можно было и кликабельный с увеличением сделать... А так большой жирный +
Поправил :)
Будет здорово, если разработчики SAMS включат в проект описанный функционал
Большое спасибо за скриптик! Поставил, может и пригодится ;)
Здравствуйте. Установил скрипт, но выдает такую ошибку:
SqStat error
Error (1): Cannot get data. Server answered: HTTP/1.0 407 Proxy Authentication Required
Squid работает в связке с sams+ncsa+samsredir. Поскажите в чем может быть проблема?
Привет!
Слова к делу не пришьёшь, а конфиг config.inc.php и squid.conf можешь - аттачь!
К слову:
http://www.opennet.ru/opennews/art.shtml?num=7455
Спасибо, но информация по ссылке мне не помогла.
Вот squid.conf:
redirect_program /usr/bin/samsredir
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/ncsa.sams
auth_param basic children 5
auth_param basic realm Squid proxy-caching web server
auth_param basic credentialsttl 2 hours
acl _sams_4b4192d7b53ba src "/etc/squid/4b4192d7b53ba.sams"
acl _sams_4b6fc6157b995 proxy_auth "/etc/squid/4b6fc6157b995.sams"
acl _sams_4b41cc70390bd proxy_auth "/etc/squid/4b41cc70390bd.sams"
acl _sams_4b419374cebaa proxy_auth "/etc/squid/4b419374cebaa.sams"
acl _sams_4b4193881a64f proxy_auth "/etc/squid/4b4193881a64f.sams"
acl all src all
acl manager proto cache_object
acl webserver src 192.168.0.25/255.255.255.255
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl Safe_ports port 3535
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow _sams_4b4192d7b53ba
http_access allow _sams_4b6fc6157b995
http_access allow _sams_4b41cc70390bd
http_access allow _sams_4b419374cebaa
http_access allow _sams_4b4193881a64f
http_access allow manager webserver
http_access deny manager
redirector_access deny localhost
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 8080
hierarchy_stoplist cgi-bin ?
cache_mem 512 MB
cache_dir ufs /var/spool/squid 10000 16 256
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern (Release|Package(.gz)*)$ 0 20% 2880
refresh_pattern . 0 20% 4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
delay_pools 5
delay_class 1 2
delay_class 2 2
delay_class 3 2
delay_class 4 2
delay_class 5 2
delay_access 1 allow _sams_4b4192d7b53ba
delay_access 1 deny all
delay_parameters 1 524288/524288 524288/524288
delay_access 2 allow _sams_4b419374cebaa
delay_access 2 deny all
delay_parameters 2 24288/24288 24288/24288
delay_access 3 allow _sams_4b4193881a64f
delay_access 3 deny all
delay_parameters 3 524288/524288 524288/524288
delay_access 4 allow _sams_4b41cc70390bd
delay_access 4 deny all
delay_parameters 4 524288/524288 524288/524288
delay_access 5 allow _sams_4b6fc6157b995
delay_access 5 deny all
delay_parameters 5 20288/20288 20288/20288
hosts_file /etc/hosts
coredump_dir /var/spool/squid
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.25";
/* Squid proxy server port */
$squidport[0]=8080;
/* 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"
?>
Вопщем, так и не понял как, но запустить скрипт получилось, причом конфиги не менял, ни свида ни sqstat.
Информация почему то обновляется долго, в течении 5 минут, при этом независимо от того сколька пользователей активно: 1 или 60. В настройках скрипта стоит автообновление через секунду. Проста мне не понятно - это нормально, так и должно долго все происходить?
Отключи редиректор для сервера с sqstat, добавив строчку в squid.conf:
redirector_access deny webserver
Спасибо за помощь, все получилось.
Не знаю зависит или нет, но на версии squid 2.6 работало, но после установки squid/3.1.1 перестало.
Пишет:
SqStat error
Error (1): Cannot get data. Server answered: HTTP/1.1 200 OK
В чем может быть косяк?
ответ оказался прост))
if($raw[0]!="HTTP/1.0 200 OK"){
надо было заменить на
if($raw[0]!="HTTP/1.1 200 OK"){
=)