#1 – The Problem

Ever since January 1st, 2011 (when the new year rolled in), Plesk servers that have Watchdog installed have started giving errors on the crons. Administrators receiving these cron error emails will see something like this:

#####################################################
Cron Daemon <root@vps.server.com>
to root@vps.server.com

date Sat, Jan 1, 2011 at 12:15 AM
subject Cron <root@vps> /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats day

ERROR: WDExc
Error occurred while processing database query: 'MySQL query failed: You  have an error in your SQL syntax; check the manual that corresponds to  your MySQL server version for the right syntax to use near 'group by  service_id, type, round(unix_timestamp(time) / 200, 0) having count(val'  at line 3'

0: wdlib.php:1088
wd__db_query(string 'select service_id, type,  unix_timestamp(min(time)) as min_time, unix_timestamp(max(time)) as  max_time, avg(value) as avg
from module_watchdog_sys_stat where
group by service_id, type,  round(unix_timestamp(time) / 200, 0) having count(value) > 1 limit  10000;')
1: pack-sysstats:63
pack_statistics(integer '200', boolean  false, boolean  false)
2: pack-sysstats:44

#####################################################

#2 – The Fix

The temporary work around was to comment out the watchdog cron so that they would not run. Plesk has created a patch that will correct this problem. Here is their forum post regarding the patch: http://forum.parallels.com/showpost.php?p=434456&postcount=42

The patch files are version specific so be sure to grab the one that matches up to your Plesk version. You need to be logged into the forums in order to download the zip files. For simplicity, you can download it from my server instead. I have also detailed all commands necessary to implement it, so you simply copy/paste the commands as you will probably find that easier.

2.1 – Download and unpack the zip file:

cd /usr/local/src/

For Plesk 8.6:

wget http://boomshadow.net/wp-content/uploads/2011/01/watchdog-2011-for-86.zip

For Plesk 9.x:

wget http://boomshadow.net/wp-content/uploads/2011/01/watchdog-2011-for-9.zip

For Plesk 9.5.x & 10.x:

wget http://boomshadow.net/wp-content/uploads/2011/01/watchdog-2011-for-95-10.zip

Now to unpack:

unzip watchdog-2011-xxxxxxxx.zip

2.2 – Backup old files and move new files into place:

mv /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats.OLD
mv pack-sysstats.sh /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats

mv /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php.OLD
mv stats-graph.php /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php

2.3 – Set ownership/permissions of new file:

chown root:psaadm /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats
chmod 754 /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats

2.4 – Clean up:

rm -rf __MACOSX watchdog-2011-xxxxxxxx.zip

#3 – Test

Test Watchdog to make sure it no longer gives errors. If successful, it should return no results when ran:

/usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats day

#4 – Revert previous temp fix:

As mentioned above, prior to the fix, a work around was suggested: to simply comment out the Watchdog crons to keep them from running. You can safely re-enable them now.

nano /var/spool/cron/root

Make sure that none of the Watchdog crons are commented out (none have the ‘#’ symbol in front). A correct root cron will look like this:

15	1	*	*	*	/usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats day
15	1	*	*	1	/usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats week
15	1	1	*	*	/usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats month
15	1	1	*	*	/usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats year
A linux web hosting administrator, a professional production sound man, and a renegade cop without nothing left to lose.... Ok, that last part is made up. In all seriousness, my passion in life is to help people; whether that be with help running their sites or with their productions. The name Boom Shadow was given to me by a great group of filmmakers called Star Wipe Films. back in 2005 and has been with me since. One of these days, I will post the full story, and many more, here. As a side note, I love my mac for video editing, my CentOS for web hosting, and my Windows box for Stepmania. Don't give me any OS hate, cause I don't care :P Also, nano is still the bomb!

Latest posts by Jacob "Boom Shadow" Tirey (see all)

Files