1 Anexo(s)
ThunderCache - Desde a Instalação até a Configuração Final! Por BillGates
Vai ai mais uma dica,eu ja estava usando para testar e esta ok...
"Peguei com o colega ED"
Limpeza da memoria no proxy.
Abaixo segue o script e também um anexo do mesmo:
Código :
#!/bin/sh
#
# Salve este script no diretório /etc/cron.hourly e dê permissão
# de execução a ele. Desse modo a cada hora sera verificada se a
# porcentagem de memória utilizada pelo sistema atingiu o valor definido
# na variável 'percent'. Caso positivo, o script informará ao kernel
# que este deverá alterar o valor da opção 'drop_caches' para 3.
#
# Mais detalhes: 'man proc' -> /proc/sys/vm/drop_caches.
PATH="/bin:/usr/bin:/usr/local/bin"
# Porcentagem máxima de uso da memória, antes de executar a limpeza:
# Obs.: [B]Altere conforme sua necessidade[/B].
percent=[B]80[/B]
# Quantidade de memória RAM no sistema:
ramtotal=`grep -F "MemTotal:" < /proc/meminfo | awk '{print $2}'`
# Quantidade de RAM livre:
ramlivre=`grep -F "MemFree:" < /proc/meminfo | awk '{print $2}'`
# RAM utilizada pelo sistema:
ramusada=`expr $ramtotal - $ramlivre`
# Porcentagem de RAM utilizada pelo sistema:
putil=`expr $ramusada \* 100 / $ramtotal`
# Checando porcentagem:
if [ $putil -gt $percent ]
then
# Sincronizando os dados cacheados na memória com o(s) disco(s):
sync
# 'Dropando' cache:
echo 3 > /proc/sys/vm/drop_caches
else
# Remove-se as variáveis da memória e finaliza-se o script:
unset percent ramtotal ramlivre ramusada putil
exit $?
fi # Fim
Da forma como esta o script,de hora em hora ele ira rodar automaticamente,e caso a memoria estiver 80% ou mais em uso,ele ira limpar...
ThunderCache - Desde a Instalação até a Configuração Final! Por BillGates
Isso ai Arlin,vou começar agora um loadbalance usando o modo pcc,creio que poderiamos através do modo pcc configurar o seguinte cenário:
Ex:
5 Links
2 Links destinados a porta 80
1 Link destinado a ser default
1 Link destinado a redirecionar vídeos e outros
1 Link destinado a redireconar as portas https,messengers e outros
Entao 2 links seriam destinados a participar do modo pcc,ficando assim:
1º Cliente a conectar vai para o Link-1,2º Cliente a conectar vai para o Link-2,3º Cliente a conectar vai para o Link-1,4º Cliente a conectar vai para o Link-2 e assim por diante...
Dessa forma poderiamos balancear a carga de navegação (80).Para os que usam apenas links ADSL seria muito bom,pois o upload e conexões simultâneas seriam muito bem divididos.
E ainda teria links de apoio para segurar outros serviços...
Vou iniciar uns testes aqui,qualquer coisa posto os resultados mais tarde...
Instalando Sarg pra gerar relatorios do squid
Bom aproveitando pra terminar o tutorial acho que faltou falar do SARG que interpreta e gera relatorios do squid
pois como eu e muitos esta seguindo o belissimo tutorial do amigo bill gates fica aqui pra quem quiser gerar os relatorios do Squid assim como os do thunder que é gerado mediante IPproxy/thunder.conf e ver visualmente as economias dos arquivos então porque não ver as pagians gravadas pelo squid do mesmo geito IPproxy/squid-reports
bom vamos as configurações que são bem simples
apt-get update
apr-get install sarg
abra o sarg.conf que se encontra em /etc/squid/sarg.conf
e confirure desta forma
# sarg.conf
#
# TAG: language
# Available languages:
# Bulgarian_windows1251
# Catalan
# Czech
# Dutch
# English
# French
# German
# Greek
# Hungarian
# Indonesian
# Italian
# Japanese
# Latvian
# Polish
# Portuguese
# Romanian
# Russian_koi8
# Russian_UFT-8
# Russian_windows1251
# Serbian
# Slovak
# Spanish
# Turkish
#por padrão vem em ingles altere pra portuguese
language Portuguese
# TAG: access_log file
# Where is the access.log file
# sarg -l file
#
access_log /var/log/squid/access.log
# TAG: graphs yes|no
# Use graphics where is possible.
# graph_days_bytes_bar_color blue|green|yellow|orange|brown|red
#
#graphs yes
#graph_days_bytes_bar_color orange
# TAG: title
# Especifique aqui o titulo da pagian que vc querira que apareça.
#
title "Relatorio Squid S & A Informatica"
# TAG: font_face
# Especify the font for html page.
#
font_face Tahoma,Verdana,Arial
# TAG: header_color
# Especify the header color
#
header_color darkblue
# TAG: header_bgcolor
# Especify the header bgcolor
#
header_bgcolor blanchedalmond
# TAG: font_size
# Especify the text font size
#
font_size 9px
# TAG: header_font_size
# Especify the header font size
#
#header_font_size 9px
# TAG: title_font_size
# Especify the title font size
#
#title_font_size 11px
# TAG: background_color
# TAG: background_color
# Html page background color
#
background_color white
# TAG: text_color
# Html page text color
#
text_color #000000
# TAG: text_bgcolor
# Html page text background color
#
text_bgcolor lavender
# TAG: title_color
# Html page title color
#
title_color green
# TAG: logo_image
# Html page logo.
#
#logo_image none
# TAG: logo_text
# Html page logo text.
#
#logo_text ""
# TAG: logo_text_color
# Html page logo texti color.
#
#logo_text_color #000000
# TAG: logo_image_size
# Html page logo image size.
# width height
#
#image_size 80 45
# TAG: background_image
# Html page background image
#
#background_image none
# TAG: password
# User password file used by authentication
# If used here, reports will be generated only for that users.
#
#password none
# TAG: temporary_dir
# Temporary directory name for work files
# sarg -w dir
#
temporary_dir /tmp
# TAG: output_dir
# The reports will be saved in that directory
# sarg -o dir
#
#output_dir /var/www/html/squid-reports
output_dir /var/www/squid-reports
# TAG: output_email
# Email address to send the reports. If you use this tag, no html reports will be generated.
# sarg -e email
#
#output_email none
# TAG: resolve_ip yes/no
# Convert ip address to dns name
# sarg -n
resolve_ip
# TAG: user_ip yes/no
# Use Ip Address instead userid in reports.
# sarg -p
user_ip no
# TAG: topuser_sort_field field normal/reverse
# Sort field for the Topuser Report.
# Allowed fields: USER CONNECT BYTES TIME
#
topuser_sort_field BYTES reverse
# TAG: user_sort_field field normal/reverse
# Sort field for the User Report.
# Allowed fields: SITE CONNECT BYTES TIME
#
user_sort_field BYTES reverse
# TAG: exclude_users file
# users within the file will be excluded from reports.
# you can use indexonly to have only index.html file.
#
exclude_users /etc/squid/sarg.users
# TAG: exclude_hosts file
# Hosts, domains or subnets will be excluded from reports.
#
# Eg.: 192.168.10.10 - exclude ip address only
# 192.168.10.0 - exclude full C class
# s1.acme.foo - exclude hostname only
# acme.foo - exclude full domain name
#
exclude_hosts /etc/squid/sarg.hosts
# TAG: useragent_log file
# useragent.log file patch to generate useragent report.
#
#useragent_log none
# TAG: date_format
# Date format in reports: e (European=dd/mm/yy), u (American=mm/dd/yy), w (Weekly=yy.ww)
#
date_format u
# TAG: per_user_limit file MB
# Saves userid on file if download exceed n MB.
# This option allow you to disable user access if user exceed a download limit.
#
#per_user_limit none
# TAG: lastlog n
# How many reports files must be keept in reports directory.
# The oldest report file will be automatically removed.
# 0 - no limit.
#
lastlog 0
# TAG: remove_temp_files yes
# Remove temporary files: geral, usuarios, top, periodo from root report directory.
#
remove_temp_files yes
# TAG: index yes|no|only
# Generate the main index.html.
# only - generate only the main index.html
#
index yes
# TAG: index_tree date|file
# How to generate the index.
#
index_tree file
# TAG: overwrite_report yes|no
# yes - if report date already exist then will be overwrited.
# no - if report date already exist then will be renamed to filename.n, filename.n+1
#
overwrite_report yes
# TAG: records_without_userid ignore|ip|everybody
# What can I do with records without user id (no authentication) in access.log file ?
#
# ignore - This record will be ignored.
# ip - Use ip address instead. (default)
# everybody - Use "everybody" instead.
#
records_without_userid ip
# TAG: use_comma no|yes
# Use comma instead point in reports.
# Eg.: use_comma yes => 23,450,110
# use_comma no => 23.450.110
#
use_comma yes
# TAG: mail_utility mail|mailx
# Mail command to use to send reports via SMTP
#
mail_utility mailx
# TAG: topsites_num n
# How many sites in topsites report.
#
topsites_num 100
# TAG: topsites_sort_order CONNECT|BYTES A|D
# Sort for topsites report, where A=Ascendent, D=Descendent
#
topsites_sort_order CONNECT D
# TAG: index_sort_order A/D
# Sort for index.html, where A=Ascendent, D=Descendent
#
index_sort_order D
# TAG: exclude_codes file
# Ignore records with these codes. Eg.: NONE/400
#
exclude_codes /etc/squid/sarg.exclude_codes
# TAG: replace_index string
# Replace "index.html" in the main index file with this string
# If null "index.html" is used
#
#replace_index <?php echo str_replace(".", "_", $REMOTE_ADDR); echo ".html"; ?>
# TAG: max_elapsed milliseconds
# If elapsed time is recorded in log is greater than max_elapsed use 0 for elapsed time.
# Use 0 for no checking
#
#max_elapsed 0
# 8 Hours
max_elapsed 28800000
# TAG: report_type type
# What kind of reports to generate.
# topusers - users, sites, times, bytes, connects, links to accessed sites, etc
# topsites - site, connect and bytes report
# sites_users - users and sites report
# users_sites - accessed sites by the user report
# date_time - bytes used per day and hour report
# denied - denied sites with full URL report
# auth_failures - autentication failures report
# site_user_time_date - sites, dates, times and bytes report
# downloads - downloads per user report
#
# Eg.: report_type topsites denied
#
#report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
# TAG: usertab filename
# You can change the "userid" or the "ip address" to be a real user name on the reports.
# Table syntax:
# userid name or ip address name
# Eg:
# SirIsaac Isaac Newton
# vinci Leonardo da Vinci
# 192.168.10.1 Karol Wojtyla
#
# Each line must be terminated with '\n'
#
usertab /etc/squid/sarg.usertab
# TAG: long_url yes|no
# If yes, the full url is showed in report.
# If no, only the site will be showed
#
# YES option generate very big sort files and reports.
#
long_url no
# TAG: date_time_by bytes|elap
# Date/Time reports will use bytes or elapsed time?
#
date_time_by bytes
# TAG: charset name
# ISO 8859 is a full series of 10 standardized multilingual single-byte coded (8bit)
# graphic character sets for writing in alphabetic languages
# You can use the following charsets:
# Latin1 - West European
# Latin2 - East European
# Latin3 - South European
# Latin4 - North European
# Cyrillic
# Arabic
# Greek
# Hebrew
# Latin5 - Turkish
# Latin6
# Windows-1251
# Koi8-r
#
charset Latin1
depois de instalado abra o com o squid.conf o do tutorial do bill gates que se encontra na pagina 3 e localize essas duas linhas #access_log /var/log/squid/access.log
#access_log /var/log/squid/error.log
e descomente as mesmas despois disso
de o comando squid -k reconfigure
feito isso pra ver os relatorios do SARG é só digitar o IPdoseuproxy/squid-reports ex. 192.168.6.2/squid-reports