Home » Technology » Statistically Speaking: AWstats Meets Asterisk and PBX in a Flash

The Most Versatile VoIP Provider: FREE PORTING

Statistically Speaking: AWstats Meets Asterisk and PBX in a Flash

For Asterisk® users that are taking advantage of a LAMP-based install such as PBX in a Flash, Elastix, or even trixbox, you already know the functionality and flexibility boost that Apache, MySQL, and PHP bring to the telephony PBX space. And once you get used to an Internet-enhanced PBX, there’s no turning back. This has only been reinforced with the major ISPs, Comcast and Time Warner to name a couple, that recently have opened up the bandwidth spigot on most broadband connections. As the screenshot shows, our Comcast service at home now provides download speeds between Charleston and Washington, DC that exceed 20Mbps while uploads now are better than a business T1 line. So you not only get better VoIP calls with more flexibility to even support conferencing, but you also can suddenly take advantage of the LAMP tools available on your Asterisk server.

Once you start using your Apache web server for something other than displaying FreePBX screens, you’ll want a statistical tool to monitor access to your server. After years of trying various tools on hosted web accounts, our vote goes to awstats which provides everything you will ever want to know about the folks accessing your web site. So today we’re delighted to bring you a 15-second installer for PBX in a Flash systems, and it should work just as well on other LAMP-based systems that house web documents in /var/www/html and provide a CGI interface in /var/www/cgi-bin. If your settings vary from these, then take a look at the install scripts and tarball before proceeding.

Prerequisites. We’re assuming you already have a perfectly functioning, LAMP-based Asterisk server chugging along. If not, download PBX in a Flash and, using our instructions, install it. Better yet, visit your closest WalMart and pick up a $199 ‘WalMart Special.’ You’ll also find the Everex gPC2 at NewEgg for $10 less. Plus you can skip the sales tax. Once you have a gPC2, use our preconfigured Osgasmatron Build, and you’ll have a fully-functioning, preconfigured system in about 15 minutes. Then come back and join today’s party.

Design Goal. Our objective with this project was to make it simple to install awstats without screwing up anything that already worked. We also didn’t want to add much performance overhead to your server. For that reason, we’ve configured awstats so that you can access it with your web browser and manually update the data any time you like. But we haven’t included a cron job to do it for you each night. A typical data refresh with awstats takes about 10 seconds so this shouldn’t be a life-altering delay for even the most impatient folks out there. It also gives you the very latest stats on demand whenever you’re in the mood. If you look at the screenshot to the left, you’ll see an Update now link on the top line. All you have to do is click on that link to refresh your awstats data anytime you want it. It’ll also show you when you last updated the awstats information. And, for those that didn’t know, all of this data is pulled from the Apache log: /var/log/httpd/access_log. If yours is named something else, then you’re obviously not going to see much in awstats other than a few samples which were generated on our server before we bundled things up.

Special Thanks. Before we walk you through the install process, let us take a moment to thank Chris Hope for a couple of great articles about awstats. If you want more detail on the inner workings of the application, then read his Installing AWStats on CentOS and Installing Geo IP PurePerl articles. We ended up not making some of the Apache configuration changes he recommended because everything worked without the mods. The major changes in our setup were the result of components being in different places on our Asterisk server. And we had to take into account the fact that Apache runs under the asterisk user name rather than the default CentOS setup.

Installing awstats. To install awstats, log into your server as root and issue the following commands:

cd /root
wget http://bestof.nerdvittles.com/applications/awstats/awstats.pbx
chmod +x awstats.pbx
./awstats.pbx

Running awstats. When the 15-second install is finished, use your favorite web browser, and go to the following link using the actual private IP address of your Asterisk server instead of 192.168.0.250: http://192.168.0.250/cgi-bin/awstats.pl. Now click the Update now link on the top line. Presto! You’re in business.

Adding a cron entry. The risk you run by not automating the awstats update process is that your Apache logs may be rotated before you next update your awstats info. To avoid this, add the following entry to /etc/crontab. This will update your awstats data each morning at 3:55 a.m., seven minutes before the Apache log is rotated.1

55 3 * * * asterisk /var/www/cgi-bin/awstats.pl ↵
-config=awstats -update > /dev/null


 

Special Thanks to Our Generous Sponsors


FULL DISCLOSURE: ClearlyIP, Skyetel, Vitelity, DigitalOcean, Vultr, VoIP.ms, 3CX, Sangoma, TelecomsXchange and VitalPBX have provided financial support to Nerd Vittles and our open source projects through advertising, referral revenue, and/or merchandise. As an Amazon Associate and Best Buy Affiliate, we also earn from qualifying purchases. We’ve chosen these providers not the other way around. Our decisions are based upon their corporate reputation and the quality of their offerings and pricing. Our recommendations regarding technology are reached without regard to financial compensation except in situations in which comparable products at comparable pricing are available from multiple sources. In this limited case, we support our sponsors because our sponsors support us.

BOGO Bonaza: Enjoy state-of-the-art VoIP service with a $10 credit and half-price SIP service on up to $500 of Skyetel trunking with free number porting when you fund your Skyetel account. No limits on number of simultaneous calls. Quadruple data center redundancy. $25 monthly minimum spend required. Tutorial and sign up details are here.

The lynchpin of Incredible PBX 2020 and beyond is ClearlyIP components which bring management of FreePBX modules and SIP phone integration to a level never before available with any other Asterisk distribution. And now you can configure and reconfigure your new Incredible PBX phones from the convenience of the Incredible PBX GUI.

VitalPBX is perhaps the fastest-growing PBX offering based upon Asterisk with an installed presence in more than 100 countries worldwide. VitalPBX has generously provided a customized White Label version of Incredible PBX tailored for use with all Incredible PBX and VitalPBX custom applications. Follow this link for a free test drive!
 

Special Thanks to Vitelity. Vitelity is now Voyant Communications and has halted new registrations for the time being. Our special thanks to Vitelity for their unwavering financial support over many years and to the many Nerd Vittles readers who continue to enjoy the benefits of their service offerings. We will keep everyone posted on further developments.
 


Some Recent Nerd Vittles Articles of Interest…

  1. Join the following line as a single line when you encounter a ↵ character. []

5 Comments

  1. AWStats can be configured to read a lot of different types of logs and report on all kinds of stats. The most common usage is of course the apache log file.

    Have you looked at tweaking AWStats to report on call data? This would give info like the most called from area codes, or states, or countries. ACT and number of calls over a years period of time, etc.

    Would be a nice addition to a AWStats for a PiaF install.

    [WM: That’d make a nice homework project… for someone else. Please share the results with the rest of us.]

  2. Hi Ward, as to the Vitelity offer; Can users from outside the US that need US DIDs and outgoing calls sign in too?

    [WM: GIve them a call, but I don’t see why not.]

  3. This may be a stupid question but in crontab is > /dev/null suppose to be on a line by itself just like it shows above or is it all one line like this? 55 3 * * * asterisk /var/www/cgi-bin/awstats.pl -config=awstats -update > /dev/null

    [WM: All in one line. Sorry.]

  4. Ward, Just wanted to say thanks. Your clear instructions helped me get up and running with Asterisk@home back in 2005. After a couple of years I installed TrixBox. Then in March I installed PBX in a Flash. Excellent work!

    Oh, and I just made a contribution via PayPal.
    Thanks again.

  5. Hi Adorah, maybe I could answer your question. Users outside the US can sign up for the Vitelity offer. If can’t, there’s always the option of changing your proxy.

Comments are closed.