Statistics not being created

Statistics not being created

by Steve Blakemore -
Number of replies: 10

I'm running Moodle 1.8.X.

I've enabled the correct flag under Administraion/Server/Statistics to turn logging on but the system is still not generating them.

Running cron.php manually gives this feedback:

<start>

Server Time: Wed, 15 Apr 2009 15:42:36 +0100 Starting activity modules Processing module function assignment_cron ...done. Processing module function chat_cron ...done. Processing module function forum_cron ...Starting digest processing... Cleaned old digest records done. Processing module function journal_cron ...done. Processing module function scorm_cron ...done. Processing module function workshop_cron ...done. Finished activity modules Starting blocks Processing cron function for search....Global searching is not enabled. Nothing performed by search. done. Finished blocks Updating languages cache Removing expired enrolments ...0 to delete none found Running backups if required... Checking backup status...INACTIVE Backup tasks finished. Running auth crons if required... Cron script completed correctly Execution took 0.226064 seconds

<end>

When I try to get statistics from the admin menu (Reports/Statistics) it just says:

<start>There is no available data to display, sorry.<end>.
Am i missing something really obvious here?
Average of ratings: -
In reply to Steve Blakemore

Re: Statistics not being created

by Angela Tapa -
I am getting exactly the same problem. I can see we stopped getting statistics on 1st March. I was able to get them no problem before. If anyone can shed some light I would be extremely grateful.
In reply to Angela Tapa

Re: Statistics not being created

by Steve Bilton -
None of my statistics work either.
I have them on, each time i visit it says you must wait XX number of days beforee trying again (before stats are available)

However when i wait this length of time then re-visit I get a similar error message with a different number of days to wait before stats are available.

No Idea why!
In reply to Steve Blakemore

Re: Statistics not being created

by HJWUCGA INC. -
Hello everyone,

I have to respond to this one because I too when through this problem for weeks and I finally got it working since my testing. I feel your pain and hopefully I can help everyone who is encountering the same weird anomaly

Here is what I have done.

1. If you can, first, upgrade your Moodle just in case. The stats query is problematic and could time out. FYI, I did not upgrade so that should ease your mind (I'm running 1.9.2). I heard it was somewhat fixed in 1.9.4 weekly build.

2. If you can, do a DB check on your mdl_stats table to make sure the statistic tables are working properly.

CHECK TABLE `mdl_stats_daily` , `mdl_stats_monthly` , `mdl_stats_user_daily` , `mdl_stats_user_monthly` , `mdl_stats_user_weekly` , `mdl_stats_weekly` , `mdl_log`

You should get something like:

mdl_stats_daily check status OK
mdl_stats_monthly check status OK
mdl_stats_user_daily check status OK
mdl_stats_user_monthly check status OK
mdl_stats_user_weekly check status OK
mdl_stats_weekly check status OK
mdl_log check status OK

3. if there there are errors, reindex/repair the tables or better yet, your entire database based on your index type (MyISAM or InnoDB)

4. Have a look at you config table and if you can reset the values for statsfirstrunlock, statslastdaily, statsruntimestarthour, and statsruntimestarminute to 0. This will force it to start from the beginning. Note that it could take a while depending on how far back your log starts to process the stats (statsfirstrun field). The values are unix/linux timestamp. Here is a page that I have found useful to calculate the dates in human friendly display. Just enter the datetime stamp values:

http://www.onlineconversion.com/unix_time.htm


5. Have a look at your stats admin page and check and uncheck a few times the "include stats" option.


6. Return to your stats admin page and see when the stats is scheduled to run and make a note of it. It's misleading because it does not run at that time you set but rather it runs on the NEXT cron call AFTER THE SCHEDULED DATE you entered. For example if you set your stats to run at 1:30 AM, it won't run at 1:30 AM as you think it should but instead it runs at the next cron call. Now get this, it does not call on the stats to run everytime so it adds more confusion. It only runs randomly and only within an allowable timeframe o it won't take a lot of server processes. Clear as mud? =)

To save everyone's time, let me show you my cron process (assuming that I have the stats schedule to run at 1:30 AM). I do a back up first using MySQL dump just in case.

10 0 * * * mysqldump -u root -pYourPassword --databases yourMoodleDB > /backup/backupMoodle19/yourMoodlebackup.sql
11 1 * * * /usr/bin/php /usr/var/www/moodle/admin/cron.php > /yourHome/name/checklogA.txt
03 2 * * * /usr/bin/php /usr/var/www/moodle/admin/cron.php > /yourHome/name/checklogB.txt

Explanation:

Assumption: Stats scheduled at: 1:30 AM

1. At 12:10 AM, Linux cron executes the MySQL mysqldump program to backup the moodle database) as mysql root user to the /backup/backupMoodle19/ folder as: yourMoodlebackup.sql

2. At 1:11 AM, the Linux cron calls the moodle cron.php script located locally in the server in /usr/var/www/moodle/admin folder and results logged in a text file called checklogA.txt in the user's home directory (/yourHome/name). It is at this call that the stats process should be scheduled and executed at the next cron call (next step number 3).

2. At 2:03 AM, the Linux cron calls the moodle cron.php script a second time located locally in the server in usr/var/www/moodle/admin folder and results logged in a text file called checklogB.txt in the user'se directory (/yourHome/name). It is at this call that the stats process should start executing/building! The log file should tell you that. It's the same as when you see it scroll onscreen via command line.


I hope this helps everyone.

Good luck.

Christopher


Average of ratings: Useful (2)
In reply to HJWUCGA INC.

Re: Statistics not being created

by Steve Bilton -
This worked a treat!

Thanks very much. I wouldn't have tried this method I you hadn't posted.

Much obliged

Steve
In reply to Steve Bilton

Re: Statistics not being created

by HJWUCGA INC. -
Steve,

Glad I was able to help. It took me weeks to figure out the big picture and I feel your (and anyone else) frustration with this module big grin




By the way, did you do them all in the order I suggested? Did you skips some steps or did you do them all?

curious

Christopher
In reply to HJWUCGA INC.

Re: Statistics not being created

by Steve Bilton -
Hi Christopher,

I did everything apart from the cron steps in the same order.

I ran cron manually, it didnt take very long, even though the stats start from the beginning of my logs; instantly statistics were populated in the stats tables.

I have around 400 meg database using a server with 10 gig of ram and the rest of the server is of good spec so it was pretty instant and didn't even seem to cause much load on the server.

As I say I never would have tried re-setting the the db tables to zero.

Again thank you Christopher.
In reply to HJWUCGA INC.

Re: Statistics not being created

by Angela Tapa -
Thank you so much Christopher. I got our techie guy to do this and it worked brilliantly!!! You are wonderful - thanks once again smile
In reply to Steve Blakemore

Re: Statistics not being created

by HJWUCGA INC. -
Hello again,

Before you try my suggestion, did you try to run it via command line?