2011-year problem in Watchdog

25 Jan 2011

If you have a linux - Plesk server along with the Watchdog module you have certainly noticed that. Since January 1rst, 2011 you are receiving email notifications (I suppose you are the administrator of that box) from Cron Daemon describing an WDExc error.

Something like that:

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

 

Work Around

Comment out the watchdog cron jobs that are causing the problem

cd /var/spool/cron/
nano root

or you know

nano /var/spool/cron/root

comment out lines
#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

check it with

cat /var/spool/cron/root

 

Solution

1. Download below the .zip correspoding to your Plesk version.

2. unzip where you like

unzip --help

3. back up first

mv /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats.bak
mv /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php.bak

if you want to backup files to your current location

mv /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats pack-sysstats.bak
mv /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php stats-graph.php.bak

4. copy files to location

mv pack-sysstats.sh /usr/local/psa/libexec/modules/watchdog/cp/pack-sysstats
mv stats-graph.php /usr/local/psa/admin/htdocs/modules/watchdog/stats-graph.php

5. permissions for pack-sysstats (i guess you logged in as root)

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

Check your watchdog stats... it worked!

References

Attachments