asparion
(usa Ubuntu)
Enviado em 10/02/2014 - 10:44h
Bom dia. acho o sarg bem melhor.
segue instalação. mastigadinho.
cria o executavel
touch sarg && chmod +x sarg && vim sarg
coloque todo o conteudo dentro do arquivo:
#!/bin/bash
yum install httpd -y
yum install make -y
yum install gcc-c++ -y
yum install vixie-cron -y
yum install wget -y
/sbin/chkconfig crond on
/etc/init.d/crond start
cd /home/
wget http://ufpr.dl.sourceforge.net/project/sarg/sarg/sarg-2.3.1/sarg-2.3.1.tar.gz
tar -xzvf sarg-2.3.1.tar.gz
cd /home/sarg-2.3.1
./configure && make && make install
mkdir /var/www/html/relatorios
mkdir /var/www/html/relatorios/Diario
mkdir /var/www/html/images
touch /var/www/html/relatorios/index.html
echo " <html>
<head>
<title>Estatisticas de Acesso Web</title>
</head>
<body>
<div align=center>
<a href=http://www.google.com.br><img border=0 src=../images/img.jpg width=\"250\" heigth=\"230\"></a>
<table border=0 cellspacing=6 cellpadding=7>
<tr>
<th align=center nowrap><b><font face=Arial size=4 color=black>Relatorios de Acesso a Internet</font></b></th>
</tr>
<tr>
<td align=center bgcolor=beige><font face=Arial size=3><a href=Diario>Diario</a></font></td>
</tr>
<tr>
<td align=center bgcolor=beige><font face=Arial size=3><a href=Semanal>Semanal</a></font></td>
</tr>
<tr>
<td align=center bgcolor=beige><font face=Arial size=3><a href=Mensal>Mensal</a></font></td>
</tr>
</table>
</div>
</body>
</html>" > /var/www/html/relatorios/index.html
echo "access_log /var/log/squid/access.log
title \"Relatorio de Acesso Web\"
font_face Tahoma,Verdana,Arial
title_color black
logo_image /images/img.jpg
logo_text_color black
image_size 287 97
output_dir /var/www/html/relatorios/Diario
resolve_ip no
user_ip yes
date_format e
remove_temp_files yes
index yes
overwrite_report yes
records_without_userid ip
topsites_num 30
exclude_codes /usr/local/etc/exclude_codes
max_elapsed 28800000
show_successful_message no
show_read_statistics no
show_sarg_info no
show_sarg_logo no
www_document_root /var/www/html
download_suffix \"zip,arj,bzip,gz,ace,doc,iso,adt,bin,cab,com,dot,drv$,lha,lzh,mdb,mso,ppt,rtf,src,shs,sys,exe,dll,mp3,avi,mpg,mpeg\"" > /usr/local/etc/sarg.conf # obs: essa linha é na mesma linha acima.
cd /var/www/html/images/
wget http://infotecnvg.com.br/imagens/infotec.png
mv infotec.png img.jpg
mkdir /etc/scripts
touch /etc/scripts/sarg.sh
echo "#!/bin/bash
DIA=\`date +%d\`
MES=\`date +%m\`
ANO=\`date +%Y\`
sarg -d \$DIA/\$MES/\$ANO
echo \"Relatorio Gerado Com Sucesso\"" > /etc/scripts/sarg.sh
cd /etc/scripts
chmod +x sarg.sh
touch /var/spool/cron/root
echo "# Relatorios de Acesso a Web
00 23 * * * /etc/scripts/sarg.sh" > /var/spool/cron/root
./sarg.sh
touch /etc/scripts/lrs.sh
cd /etc/scripts
chmod +x lrs.sh
echo "#!/bin/bash
time_limit=30
find /var/www/html/relatorios/Diario -type d -ctime +\$time_limit -exec rm -rf {} \;" > /etc/scripts/lrs.sh
echo "# Apagando relatorios maior que 30 dias
00 13 * * * /etc/scripts/lrs.sh" >> /var/spool/cron/root
echo "##############################################################"
# Colocando Senha no acesso do sarg no Navegador
touch /var/www/html/relatorios/.htaccess
echo "AuthType Basic
AuthName \"Acesso restrito!\"
AuthUserFile /var/www/html/relatorios/.htpasswd
require valid-user" > /var/www/html/relatorios/.htaccess
htpasswd -c /var/www/html/relatorios/.htpasswd admin
echo "######################################################################################################################" >> /etc/httpd/conf/httpd.conf
echo "#linha0" >> /etc/httpd/conf/httpd.conf
sed -i '/linha0/s/^\(.*\)$/\1\nAlias \/sarg \/var\/www\/html\/relatorios/' /etc/httpd/conf/httpd.conf
echo "#linha1" >> /etc/httpd/conf/httpd.conf
sed -i '/linha1/s/^\(.*\)$/\1\n<Directory "\/var\/www\/html\/relatorios">/' /etc/httpd/conf/httpd.conf
echo "#linha2" >> /etc/httpd/conf/httpd.conf
sed -i '/linha2/s/^\(.*\)$/\1\n Options Indexes MultiViews/' /etc/httpd/conf/httpd.conf
echo "#linha3" >> /etc/httpd/conf/httpd.conf
sed -i '/linha3/s/^\(.*\)$/\1\n AllowOverride All/' /etc/httpd/conf/httpd.conf
echo "#linha4" >> /etc/httpd/conf/httpd.conf
sed -i '/linha4/s/^\(.*\)$/\1\n Order allow,deny/' /etc/httpd/conf/httpd.conf
echo "#linha5" >> /etc/httpd/conf/httpd.conf
sed -i '/linha5/s/^\(.*\)$/\1\n Allow from all/' /etc/httpd/conf/httpd.conf
echo "#linha6" >> /etc/httpd/conf/httpd.conf
sed -i '/linha6/s/^\(.*\)$/\1\n<\/Directory>/' /etc/httpd/conf/httpd.conf
echo "######################################################################################################################" >> /etc/httpd/conf/httpd.conf
service httpd restart
#-------------------- fim do Script -----------------------#
execute
./sarg
agora e so acessar no seu navegador
http://ipdoservidor/relatorios
teste ai pra ver nao vai se arrepender
abraços