+ Responder ao Tópico



  1. movido para nova area de artigos por favor deem uma olhada

  2. Olha, só, fiz este patch para não consumir muita internet (o $download_speed funciona com umas modificações, mas mesmo assim consumia tudo). Ele pega a config $max_concurrent_downloads do thunder.conf, e se já passou do limite, manda a url original pro squid.

    Basicamente, ele limita os downloads simultaneos até o limite definido no $max_concurrent_downloads.
    Ainda há alguns bugs, como várias pessoas acessando o mesmo vídeo ao mesmo tempo, só a primeira vai pegar via stream, as outras vão pegar do servidor. Mas se o arquivo já estiver no hd, vai dar hit normal.

    Fiz o upload em um tar.gz para facilitar (junto com meu thunder.conf). Subistituir o functions.php e o downloader.php. Olhar o thunder.conf e adicionar as linhas $max_concurrent_downloads e $down_lock como as suas necessidades.
    Como recomendável, faça um backup desses arquivo no caso de não funcionar.

    Ah, minha função logadd grava em um arquivo, no caso /var/log/thunder.log. Se não quiserem, é só voltar para a função antiga.



  3. 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

  4. Uso esse script para dar os HIT de dois servidores que tenho, tudo que vem desses servidores será marcado como HIT. Atentem que uso Windows, então modifiquem os caminho dos arquivos conforme sua distro
    Código :
    #!/bin/bash
    # Este script ira salvar o access.log compactado e ja com os HIT's certos...
    LOCAL=`pwd`
     
    LOG_FOLDER="/e/squid/var/logs"
    LOG_FILE="access.log"
     
    BACKUP_FOLDER="/c/backups/logs"
     
    BACKUP_FILE="access-mes-dia-ano-`date +%m-%d-%Y--%H-e-%M`.tar.gz"
     
    if [ ! -f "$LOG_FOLDER/$LOG_FILE" ]
    then
        echo "criando arquivo de log em branco..."
        touch "$LOG_FOLDER/$LOG_FILE"
    fi
     
    echo "Entrando no diretorio $LOG_FOLDER"
    cd "$LOG_FOLDER"
    echo "Fazendo arquivo temporario"
    cp "$LOG_FILE" "$LOG_FILE.new"
     
    echo "Modificando os HITS"
    # Tira todos os TCP_qualquer_coisa para TCP_HIT
    cat "$LOG_FILE.new" | 
    /bin/sed '
    \@192\.168\.0\.1@{
            s@TCP_[[:alpha:]]*/@TCP_HIT/@
    }
    ' > "$LOG_FILE.new.sed"
     
    cat "$LOG_FILE.new.sed" | 
    /bin/sed '
    \@192\.168\.0\.110@{
            s@TCP_[[:alpha:]]*/@TCP_HIT/@
    }
    ' > "$LOG_FILE.new.sed2"
     
    echo "Removendo arquivos temporarios"
    rm "$LOG_FOLDER/$LOG_FILE"
    rm "$LOG_FOLDER/$LOG_FILE.new"
    rm "$LOG_FOLDER/$LOG_FILE.new.sed"
    # echo "mv -T $LOG_FOLDER/$LOG_FILE.new.sed $LOG_FOLDER/$LOG_FILE"
    echo "Movendo arquivo final"
    mv "$LOG_FOLDER/$LOG_FILE.new.sed2" "$LOG_FOLDER/$LOG_FILE"
     
    /bin/tar -czf "$BACKUP_FOLDER/$BACKUP_FILE" "$LOG_FOLDER/$LOG_FILE"
     
    > "$LOG_FOLDER/$LOG_FILE"
    rm "$LOG_FOLDER/$LOG_FILE"
     
    #Voltando ao diretorio inicial...
    cd "$LOCAL"



  5. Ae galerinha do forum, aproveito para anunciar que o Thunder 3 já está funcional.

    Ele foi concebido para ser um proxy paralelo ao squid, foi escrito em C++ e usa sqlite para auxiliar a indexação dos arquivos.

    Vamos entrar agora em periodo de testes e ajustes finos para depois ser liberado para todos.

    Quem quiser testar, entre no forum do thunder cache, e responda ao topico.

    Obrigado galera!






Tópicos Similares

  1. Respostas: 12
    Último Post: 30-09-2009, 10:28
  2. Respostas: 0
    Último Post: 09-08-2009, 20:05
  3. Respostas: 0
    Último Post: 08-08-2009, 20:14
  4. Respostas: 0
    Último Post: 08-08-2009, 13:33
  5. Respostas: 0
    Último Post: 08-08-2009, 11:12

Visite: BR-Linux ·  VivaOLinux ·  Dicas-L