Quinico web insights

Quinico web insights

Quinico is an open source web application designed to help you easily improve your website’s performance, reduce errors and optimize for search engines (SEO).  Quinico can constantly monitor your websites and alert you when there is a problem that requires attention.  Using Quinico, you can automate the continual tracking, reporting and alerting of the following:

  • Google search engine rankings of all of your important keywords (supports all google domains and languages)
  • Google Pagespeed metrics including suggestions for improvement (mobile and desktop strategies)
  • Page weight breakdown (mobile and desktop strategies)
  • SEO url metrics (utilizing SEOMoz)
  • Webpagetest performance metrics (including first and repeat views)
  • Google webmaster metrics (keyword impressions/clicks, crawl errors, top search queries)

Zabbix – The Enterprise-class Monitoring Solution

Zabbix – The Enterprise-class Monitoring Solution

Zabbix is the ultimate open source availability and performance monitoring solution. Zabbix offers advanced monitoring, alerting, and visualization features today which are missing in other monitoring systems, even some of the best commercial ones. Below is a short list of features available in Zabbix:

  • auto-discovery of servers and network devices
  • low-level discovery
  • distributed monitoring with centralized web administration
  • support for both polling and trapping mechanisms
  • server software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X
  • native high performance agents (client software for Linux, Solaris, HP-UX, AIX, FreeBSD, OpenBSD, OS X, Tru64/OSF1, Windows NT4.0, Windows 2000, Windows 2003, Windows XP, Windows Vista)
  • agent-less monitoring
  • secure user authentication
  • flexible user permissions
  • web-based interface
  • flexible e-mail notification of predefined events
  • high-level (business) view of monitored resources
  • audit log

Monitoring PHP errors, warnings, and notices

There are a number of ways to monitor PHP errors, warnings, and notices.   You can have your application code trigger some error handling, you can use PHP built-in methods, you can have some scripts running in the background analyzing logs, etc.  While you already probably do some of it, here is something that you’ll find handy.

First of all, don’t log all PHP noise into a single file.   You can easy make separate logs for each project.  Somewhere at the top of your project, when it only starts loading, add the following configuration settings:

ini_set('error_reporting', E_ALL);
ini_set('log_errors', '1');
ini_set('error_log', '/path/to/project/logs/php_errors.log');
ini_set('display_errors', '0');

This will enable logging of all errors, warnings, and notices into a file that you specified. And, at the same time, it will disable the display of all the logs to your visitors (something that you should definitely do for a production server).

One you’ve done that, you’ll notice another problem. If your application is of any considerable size and/or if it uses a lot of third-party code, you’ll get buried in all those warnings and notices. The file will quickly become very large and boring and leave your attention span. Not good. While you can fight the size of the file with a tool like logrotate, the boredom is a more serious problem. The same notices and warnings appear over and over and over. You’ll fix some of them and the others will stay there forever. What you need as a way to have a quick overview of what is broken and what is noisy.

Today I wrote a quick cronjob to do just that. Here it is in all its entirety.

#!/bin/bash

# This script parses the project PHP errors logs every hour, creates the summary of all
# errors/warnings/notices/etc and emails that summary to the email specified below.

EMAIL="me@here.com"
SUBJECT="here.com PHP errors summary for the last hour"
PHP_ERRORS_FILE="/path/to/project/logs/php_errors.log"

# The log starts with timestamp like [01-Mar-2010 12:48:56]. Timestamp + 1 stamp occupy about 24 bytes
ONE_HOUR_AGO=`date +'[%d-%b-%Y %H:' -d '1 hour ago'`

# We only need that double backslash because date pattern uses square bracket
grep "^\\$ONE_HOUR_AGO" $PHP_ERRORS_FILE | cut -b 24- | sort | uniq -c | sort -n -r | mail -s "$SUBJECT" $EMAIL

You can drop this file into /etc/cron.hourly/report_php_errors.sh, change permissions to executable, and wait for the next run of hourly scripts. If you’ve updated the variables inside the script to reflect the correct email address and path to log file, you’ll get an email every hour which will look something like this:

From: cron@your.host
To: me@here.com
Subject: here.com PHP errors summary for the last hour

  14 PHP Notice:  Use of undefined constant PEAR_LOG_DEBUG - assumed 'PEAR_LOG_DEBUG' in /some/path/to/some/file.php on line 17
    12 PHP Notice:  Undefined index:  is_printed in /path/to/something.php on line 2035
     9 PHP Notice:  Undefined index:  blah in /some/foo/bar.php on line 42
     7 PHP Notice:  Undefined offset:  1 in /some/verifier/script.php on line 120

The email will not be limited to 3 or 4 lines. It will actually contain each and every individual notice, error, and warning that occurred during the last hour in your project. The list will be sorted by how often each warning occurred, with the most frequent entries at the top.

With this list you can start fixing your most frequently seen problems, and you can also notice weird activity much faster than just checking the log file and hoping to catch it with your own eyes.

Enjoy!

Web site monitoring

Devlounge lists three web site monitoring services : Montastic, Mon.itor.us, and LinkPatch.  These services check your web sites regularly and notify you when something goes down.  They also provide additional services, like checking for broken links and such.

While I personally prefer a full featured monitoring tool such as Nagios (with SMS integration via Clickatell), it’s good to know that there are simple and straight-forward ways for basic monitoring.  After all,  installing and configuring Nagios makes sense only if you are geek or monitoring things is a big part of your business.

Update: Also http://www.alertra.com/ was recommended to me by Michael Cohen over on Google Buzz.