Hello,

That's a faily simple bash script. 

"cat" the log file to an awk script like so;

cat /usr/local/freeswitch/log/cdr-csv/Master.csv | sed "s/\\\"//g" | awk '{ FS=","; }{ if($9>0){ CONN=CONN+1; } TOTAL=TOTAL+1; }END{ print "CONNECT: "CONN; print "TOTAL: " TOTAL; ASR=(CONN/TOTAL)*100; print "ASR: "ASR; if(ASR<100){ system("echo send email");} }' 

the "system" is where you put the mail command

also, bear in mind that the master can get VERY large if you don't rotate it.

david

On Wed, Oct 26, 2011 at 1:59 PM, Faisal Rehman <faisal.rehman22@hotmail.com> wrote:
Hi Waseem,

Thanks for your help, I saw the scripts that were on the link that you provided to me but actually the problem is that I don't want to involve the database though it is a bit difficult task but according to my requirement I just want to read the whole Master.csv file & if the ASR or ACD is low on any server, it should send me email, so my question is how can I skip the database from it to interact directly with the Master.csv file.


Thanks in Advance!!

Faisal Rehman


From: wasim@convergence.pk
Date: Tue, 25 Oct 2011 07:32:35 +0500
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Script for ASR & ACD Monitoring


Faisal:

Load up the CDR into a db (MySQL or otherwise) ...

For ACD you'll want a SQL query akin
  • SELECT COUNT(*) AS calls_answered, SUM(billusec) AS billusec, SUM(billusec)/COUNT(*) AS acd FROM freeswitchdb.freeswitchcdr WHERE disposition=1;
For ASR you'll need another query
  • SELECT COUNT(*) AS calls_total FROM freeswitchdb.freeswitchcdr;
  • ASR is calls_answered/calls_total
There is sample (read: poor) code in http://jira.freeswitch.org/browse/FS-1981
which a google for "freeswitch ACD ASR" would have helped you get to in the first place.

-wasim

On Mon, Oct 24, 2011 at 15:39, Faisal Rehman <faisal.rehman22@hotmail.com> wrote:
Hi Everyone,

I want to write a script that reads the Master.csv & generate an alert if the ASR & ACD is low from the desired value. Anybody has written such script, please help me write it or provide any sample.


Thanks


Faisal Rehman


FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




--
wasim h. baig | principal consultant | convergence pk | +92 30 0850 8070 | peace be upon you ...

FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org


FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org