How to Install
Fazer o Download dosoftware:
cd /usr/src
wget http://www.asternic.org/stats/asternic-stats-1.3.tgz
ou baixar clicando aqui
Descompactar:
tar zvxf asternic-stats-1.3.tgz
cd asternic-stats
Create a mysql database:
mysqladmin -u root -p create qstats
Create the tables for the database:
mysql -u root -p qstats < sql/qstats.sql
IMPORTANTISSIMO ADICIONAR ESSAS DUAS LINHAS PARA FUNCIONAMENTO (no config.php):
$queue_log_dir = '/var/log/asterisk/';
$queue_log_file = 'queue_log';
Edit /usr/src/asternic-stats/html/config.php to set authenticate information for the database:
$dbhost = 'localhost';
$dbname = 'qstats';
$dbuser = 'root';
$dbpass = '';
$manager_host = "127.0.0.1";
$manager_user = "admin";
$manager_secret = "admin";
$language = "es";
Edit /usr/src/asternic-stats/parselog/config.php with auth information for the database:
$queue_log_dir = '/var/log/asterisk/';
$queue_log_file = 'queue_log';
$dbhost = 'localhost';
$dbname = 'qstats';
$dbuser = 'root';
$dbpass = '';
ATENÇÃO!!!! Nesse arquivo o nome do database esta errado.. esta $dbname = ‘qstat’; NO SINGULAR.. alterar para plural!!!!
Criar no /etc/asterisk/manager.conf
[admin]
secret=admin
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user
Move the html directory to Apache DocumentRoot:
mv /usr/src/asternic-stats/html /var/www/html/queue-stats
Move the parselog directory to its new home:
mv /usr/src/asternic-stats/parselog /usr/local
Pode enviar o config e o lang/pt_BR.php (dessa forma de diretorio) para o /usr/local/parselog/
=======================================
Create a cron job to parse data from queue_log and populate the database:
crontab -e
No manual, esta escrito para executar no cron assim:
And type this in your cronjob file:
0 0 * * * php -q /usr/local/parselog/parselog.php convertlocal
Porem somente deu certo para mim quando executei de 1 em 1 minuto assim:
*/1 * * * * root /usr/bin/relatorio.sh
onde relatorio.sh contem:
#!/bin/sh
php -q /usr/local/parselog/parselog.php convertlocal
lembrando de dar o chmod +x no mesmo. :)
=======================================
PARA VER O LOG se tem ou não sucesso basta editar o arquivo parselog.php comentando do mesmo a linha:
#error_reporting(0);
You can save it by pressing “:x”
Para passar para portugues:
A tradução feita por Edter Miotto pode ser baixada em: http://usuarios.upf.br/~eder/asternic-stats-lang-pt_BR.tar.gz
ou clicando aqui
Para instalar o modulo pt_Br do Asternic, basta copiar o arquivo pt_BR.php para dentro da pasta html/lang e alterar o variável $language para pt_Br dentro do arquivo config.php de acordo.
To parse the log at periodic intervals via a cronjob:
Inside the /parselog directory you will find a script to do the job:
./parselog.php
If you dont have binftm_misc installed you might need to run:
php -q ./parselog.php
Clean up database
If you want to clean up the data and start over and fresh, you can run
./parselog.php purge
Finally, you can see the statistics and reports with your browser from http://ip.asterisk/queue-stats