Could someone please take a look and see if you can figure out why my STATS aren't running.

Ok,
One of the things that I would check first is to ensure that you have the timezone setup in your php.ini. In the Date section find the line ;date.timezone =, you will want to uncomment it by removing the semi-colon from the front of it and set it to the timezone that you have set in Administration > Locations. The line in your ini file should look like this date.timezone ='American/Denver' Make sure that you keep the single quotes or it won't work.
Scott Karren
Running daily statistics gathering, starting at 1210482000: ................ finished until 1210568400: Monday, 12 May 2008, 12:00 (in 1 s) ................ finished until 1210654800: Tuesday, 13 May 2008, 12:00 (in 1 s) ................ finished until 1210741200: Wednesday, 14 May 2008, 12:00 (in 1 s) ................ finished until 1210827600: Thursday, 15 May 2008, 12:00 (in 1 s) ................ finished until 1210914000: Friday, 16 May 2008, 12:00 (in 0 s) ................ finished until 1211000400: Saturday, 17 May 2008, 12:00 (in 1 s) ................ finished until 1211086800: Sunday, 18 May 2008, 12:00 (in 0 s) ................ finished until 1211173200: Monday, 19 May 2008, 12:00 (in 1 s) ................ finished until 1211259600: Tuesday, 20 May 2008, 12:00 (in 1 s) ................ finished until 1211346000: Wednesday, 21 May 2008, 12:00 (in 0 s) ................ finished until 1211432400: Thursday, 22 May 2008, 12:00 (in 1 s) ................ finished until 1211518800: Friday, 23 May 2008, 12:00 (in 0 s) ................ finished until 1211605200: Saturday, 24 May 2008, 12:00 (in 0 s) ................ finished until 1211691600: Sunday, 25 May 2008, 12:00 (in 1 s) ................ finished until 1211778000: Monday, 26 May 2008, 12:00 (in 1 s)
Thanks for any help.
We're having the same problem at the moment. I know that the statistics reports were working on the 18th September as I used them then. I've just gone to update the report I generated and I get the same error message described previously:
"There is no available data for that combination of course and time period."
Interestingly, if I go back as far as Two Months, the reports all run fine. As soon as I filter for weeks, they give me the error message. When I ran the reports on the 18th September, I went back for Three Weeks.
Any help would be greatly appreciated. I've tried the solutions suggested above to no avail.
We're running 1.9.2 having upgraded from 1.8 over the summer. Incidently, we have two different Moodles, both upgraded over the summer. The reports on both Moodles worked fine on the 18th September and neither work now. They each have a dedicated server and are on separate domains in the network. I'm wondering if it is a problem common to the upgrade?
Hello!
We are having the same problem, statistics from september 20th are not working anymore "there is no data". I have the cron.php not working and have to execute it myself.
Up until then the statistics are all recorded and working perfectly when asked into the system. We are running Moodle 1.8.
They used to work perfectly, until apparently the users table got problems and I had to Repair it, and the table works fine since then; but following to that (I do not know if it is related or not) statistics are not being recorded.
Can anyone help us?
Thanks a lot
We are experiencing a similar thing on our new Moodle 1.9 built over the summer with the addition of 1.8 courses through the backup process.
I can see 4 week old statistics but nothing within the last two weeks, I can see all the logs it's just the statistics that aren't working
Our error message say " Statistics is currently in catchup mode. So far 22 day(s) have been processed and 20 are pending. Check back soon!"
Hope you can help?
Backup tasks finished.
Running auth crons if required...
...preventing stats to run, more than 4 hours since scheduled time.
Cron script completed correctly
Max processing - 6 months
Max runtime - until complete
Days to process - 31
Run at - 23:55pm
User threshold - 0
Max parent categories - 2
Cheers
Teresa
I encountered this same problem a couple of months ago and after a weeks of investigation, I got it to work again. It's the way the cron is scheduled and it's parameters... I posted my detailed fix on another thread and it really seems to help others.
Here is the thread url
http://moodle.org/mod/forum/discuss.php?d=121225
Here it is again:
xxxxxxxxxxxxxxxx
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
xxxxxxxxxxxxxxxx
Buy me a nice latte (not Starbucks please) if this solves your problem

I tried Chistopher's solution, but still get this error that the end of http://mysite.org/admin/cron.php
<!--StartFragment-->Running auth crons if required...
...preventing stats to run, last execution was less than 20 hours ago.
Cron script completed correctly
Execution took 18.531617 seconds
Can anyone shed some light on this?
TIA,
Eric
1. My site is huge (22000+ users, 3000+ courses). Cron was being called via wget, but I figured it was timing out while executing the cron.php. I ended up calling the cron.php from the command line via:
php /var/www/html/path/to/cron.php
In the crontab, I set my cron to run every 30 mins instead of the initial setting of 5 min.
2. I used Christopher Lawerence's suggestion to force the cronjob to trigger statistics processing, by resetting some values in the database.
I went directly into the database backend and ran the following query:
select * from mdl_config
where name like '%stat%'
I set the following to numerical ZERO (0).
statsfirstrun
statsfirstrunlock
statslastdaily
statslastweekly
statslastmonthly
statslastexecution
I then *disabled* my cron, so that I could manually trigger the cron.php from the command line, in order to monitor it.
Time to manually call the cron from the command line on the webserver.
php /var/www/html/path/to/cron.php
I saw the stats processing....it took a very long time but it became up to date!
Remember to *enable* the cron after this job is complete!!
I will be monitoring it to ensure that it continues to work.
Additional tips on Statistics settings in Admin->Server->Statistics
1. Depending on your site size, stats processing can be extremely resource intensive, I noticed that processor usage was consistently at 100%.
Set MaxRuntime to under 6 hours (not Until Complete - especially if you have a large site!)
2. Run at: You need to know your server inside out for this setting. For example, i have scripts to optimize my database, backup, zip it and transfer it to another server. Based on my hardware logging, these scripts hog memory and i needed to sets my stats to process outside of these periods of heavy activity.
Set your stats processing time when there is the least amount of activity on your site.
I hope this helps. I will update if anything changes.
Cheers,
-n
reset, restart the cron and call the cron more often.
Some may experience a catch up mode so don't worry because the stats are only allowed to run X number of times for a given period and can be db intensive.
One idea you could do (and only if it's feasible) is to have the same db and stats running on a separate moodle instance just for this procedure.
How do I set those to 0:
mysql> select * from mdl_config where name like '%stats%';
+------+----------------------------+------------+
| id | name | value |
+------+----------------------------+------------+
| 42 | enablestats | 1 |
| 103 | statsfirstrun | 604800 |
| 104 | statsmaxruntime | 0 |
| 105 | statsuserthreshold | 0 |
| 127 | statsruntimestarthour | 0 |
| 128 | statsruntimestartminute | 45 |
| 229 | statsfirstrunlock | 0 |
| 231 | statslastdaily | 1261465200 |
| 232 | statslastweekly | 1257663600 |
| 233 | statslastmonthly | 1257055200 |
| 269 | statsrolesupgraded | 1175719586 |
| 414 | statscatdepth | 4 |
| 961 | statsruntimedays | 31 |
| 1000 | coursereport_stats_version | 2007101501 |
| 1004 | statslastexecution | 1266911110 |
| 1115 | statsrunning | 1266912515 |
+------+----------------------------+------------+
Starting activity modules
Processing module function assignment_cron ...done.
Processing module function forum_cron ...Starting digest processing...
Cleaned old digest records
done.
Processing module function journal_cron ...done.
Processing module function workshop_cron ...done.
Finished activity modules
Starting blocks
Processing cron function for rss_client....
http://youngentrepreneurfoundation.wordpress.com/feed/ ok
http://dansmath.libsyn.com/rss ok
http://history360.blogspot.com/atom.xml ok
http://www.pbs.org/teachersource/learning.now/rss2/index.xml ok
http://moodletraining.blogspot.com/atom.xml ok
http://www.speedofcreativity.org/feed/ ok
http://feeds.feedburner.com/netfamilynews/MmPS?forss.xml ok
http://www.sciencedaily.com/rss/newsfeed.xml ok
http://sciencenow.sciencemag.org/rss/current.xml ok
http://speakingofhistory.blogspot.com/feeds/posts/default ok
Technology club
Next execution: Thursday, 25 February 2010, 02:00 AM
Classroom MGT 101
Next execution: Thursday, 25 February 2010, 02:00 AM
Informal Geometry-High School
Next execution: Thursday, 25 February 2010, 02:00 AM
Spanish II
Next execution: Thursday, 25 February 2010, 02:00 AM
Spanish I
Next execution: Thursday, 25 February 2010, 02:00 AM
English 2 - Masterton
Next execution: Thursday, 25 February 2010, 02:00 AM
Pre-Calculus/Trigonometry-- Parker
Next execution: Thursday, 25 February 2010, 02:00 AM
M.Smith Math Courses
Next execution: Thursday, 25 February 2010, 02:00 AM
Geometry - Webb
Next execution: Thursday, 25 February 2010, 02:00 AM
Heads Up! Reading
Next execution: Thursday, 25 February 2010, 02:00 AM
921834
SKIPPING - hidden+unmodified
Next execution: Thursday, 25 February 2010, 02:00 AM
Geometry
Next execution: Thursday, 25 February 2010, 02:00 AM
Pre-Algebra
SKIPPING - hidden+unmodified
Next execution: Thursday, 25 February 2010, 02:00 AM
College Composition Nolting
Next execution: Thursday, 25 February 2010, 02:00 AM
Algebra I - Busby
Next execution: Thursday, 25 February 2010, 02:00 AM
Geometry - GSmith
Next execution: Thursday, 25 February 2010, 02:00 AM
US History 500
Next execution: Thursday, 25 February 2010, 02:00 AM
Character Education 101
Next execution: Thursday, 25 February 2010, 02:00 AM
Chemistry
Next execution: Thursday, 25 February 2010, 02:00 AM
English 9
Next execution: Thursday, 25 February 2010, 02:00 AM
Biology
Next execution: Thursday, 25 February 2010, 02:00 AM
Graphics Design
Next execution: Thursday, 25 February 2010, 02:00 AM
Geometry-keep
Next execution: Thursday, 25 February 2010, 02:00 AM
Accounting 1 Keep
Next execution: Thursday, 25 February 2010, 02:00 AM
Cisco CCNA Discovery (1): Networking for Home and Small Businesses
Next execution: Thursday, 25 February 2010, 02:00 AM
Blended Learning Environments
Next execution: Thursday, 25 February 2010, 02:00 AM
Natural Science 2
Next execution: Thursday, 25 February 2010, 02:00 AM
VALTS US History (KM)
Next execution: Thursday, 25 February 2010, 02:00 AM
Emergency Medical Technician
Next execution: Thursday, 25 February 2010, 02:00 AM
Language Arts I
Next execution: Thursday, 25 February 2010, 02:00 AM
Think Globally....Act Locally
SKIPPING - hidden+unmodified
Next execution: Thursday, 25 February 2010, 02:00 AM
Entrepreneurship
Next execution: Thursday, 25 February 2010, 02:00 AM
Cisco CCNA Discovery (2): Working at a Small-to-Medium Business or ISP
Next execution: Thursday, 25 February 2010, 02:00 AM
Spanish III
Next execution: Thursday, 25 February 2010, 02:00 AM
8th Grade Careers
SKIPPING - hidden+unmodified
Next execution: Thursday, 25 February 2010, 02:00 AM
VALTS English Quarter 3 Winter 2010
Next execution: Thursday, 25 February 2010, 02:00 AM
US History (Semester 2: 2009-2010)
Next execution: Thursday, 25 February 2010, 02:00 AM
World History (Semester 2: 2009-2010)
Next execution: Thursday, 25 February 2010, 02:00 AM
Advanced Environmental Science Spring '10
Next execution: Thursday, 25 February 2010, 02:00 AM
General Biology Spring '10
Next execution: Thursday, 25 February 2010, 02:00 AM
Algebra 1A Spring 2010
Next execution: Thursday, 25 February 2010, 02:00 AM
Crawford High School Principal Information
Next execution: Thursday, 25 February 2010, 02:00 AM
Vet Science
Next execution: Thursday, 25 February 2010, 02:00 AM
Small Animal Care and Management
Next execution: Thursday, 25 February 2010, 02:00 AM
High School Vocal Music
Next execution: Thursday, 25 February 2010, 02:00 AM
Rhodes Weights and Fitness
Next execution: Thursday, 25 February 2010, 02:00 AM
Girls Physical Education
Next execution: Thursday, 25 February 2010, 02:00 AM
Gering Alternative Program
Next execution: Thursday, 25 February 2010, 02:00 AM
Guidance 12 Grade Timeline
Next execution: Thursday, 25 February 2010, 02:00 AM
Electronics
Next execution: Thursday, 25 February 2010, 02:00 AM
ART II, Cook
Next execution: Thursday, 25 February 2010, 02:00 AM
Mr Sulu - Spanish 1
Next execution: Thursday, 25 February 2010, 02:00 AM
Automotive Technology 1
Next execution: Thursday, 25 February 2010, 02:00 AM
9TH Grade Welding
Next execution: Thursday, 25 February 2010, 02:00 AM
Sra. Vohland Spanish II
Next execution: Thursday, 25 February 2010, 02:00 AM
Auto Cad 1
Next execution: Thursday, 25 February 2010, 02:00 AM
Boys 10th Grade Physical Education
Next execution: Thursday, 25 February 2010, 02:00 AM
High School Instrumental Music
Next execution: Thursday, 25 February 2010, 02:00 AM
9th Grade Computers
Next execution: Thursday, 25 February 2010, 02:00 AM
Spanish IV
Next execution: Thursday, 25 February 2010, 02:00 AM
Guidance 12 Grade Timeline
Next execution: Thursday, 25 February 2010, 02:00 AM
Welding 1
Next execution: Thursday, 25 February 2010, 02:00 AM
Advanced Auto technology
Next execution: Thursday, 25 February 2010, 02:00 AM
Crawford PBS
Next execution: Thursday, 25 February 2010, 02:00 AM
Technology B2
Next execution: Thursday, 25 February 2010, 02:00 AM
Art III
Next execution: Thursday, 25 February 2010, 02:00 AM
Art IV
Next execution: Thursday, 25 February 2010, 02:00 AM
Physical Science
Next execution: Thursday, 25 February 2010, 02:00 AM
Freshman Regional Studies
Next execution: Thursday, 25 February 2010, 02:00 AM
Mrs. Trautman's Math 2
Next execution: Thursday, 25 February 2010, 02:00 AM
American Government
Next execution: Thursday, 25 February 2010, 02:00 AM
Introduction to Law
Next execution: Thursday, 25 February 2010, 02:00 AM
Transition Issues I
Next execution: Thursday, 25 February 2010, 02:00 AM
Physiology 1
Next execution: Thursday, 25 February 2010, 02:00 AM
International Relations
Next execution: Thursday, 25 February 2010, 02:00 AM
Transition Issues II
Next execution: Thursday, 25 February 2010, 02:00 AM
Mrs. Trautman's Math 3
Next execution: Thursday, 25 February 2010, 02:00 AM
Physiology 2
Next execution: Thursday, 25 February 2010, 02:00 AM
Work Experience
Next execution: Thursday, 25 February 2010, 02:00 AM
Mrs. Trautman's Math 4
Next execution: Thursday, 25 February 2010, 02:00 AM
English 9A(HS)
Next execution: Thursday, 25 February 2010, 02:00 AM
English 10A (HS)
Next execution: Thursday, 25 February 2010, 02:00 AM
English 10B (HS)
Next execution: Thursday, 25 February 2010, 02:00 AM
English 9B (HS)
Next execution: Thursday, 25 February 2010, 02:00 AM
Advanced Mathematics
Next execution: Thursday, 25 February 2010, 02:00 AM
Mrs. Gable Family and Consumer Sciences
Next execution: Thursday, 25 February 2010, 02:00 AM
Beyond the Basics Sign Language
Next execution: Thursday, 25 February 2010, 02:00 AM
US History Demo Unit
Next execution: Thursday, 25 February 2010, 02:00 AM
Consumer Math
Next execution: Thursday, 25 February 2010, 02:00 AM
Koenen-High scchool General English
Next execution: Thursday, 25 February 2010, 02:00 AM
Quadratics
Next execution: Thursday, 25 February 2010, 02:00 AM
Sociology
Next execution: Thursday, 25 February 2010, 02:00 AM
Language Arts I
Next execution: Thursday, 25 February 2010, 02:00 AM
Psychology
Next execution: Thursday, 25 February 2010, 02:00 AM
Comparative Religion
Next execution: Thursday, 25 February 2010, 02:00 AM
United States History
Next execution: Thursday, 25 February 2010, 02:00 AM
Western Civilization II
Next execution: Thursday, 25 February 2010, 02:00 AM
Accordian Example
Next execution: Thursday, 25 February 2010, 02:00 AM
Online Learning Professional Development
Next execution: Thursday, 25 February 2010, 02:00 AM
Current Global Issues
Next execution: Thursday, 25 February 2010, 02:00 AM
Environmental Science
Next execution: Thursday, 25 February 2010, 02:00 AM
Matt McKay- Earth Science
Next execution: Thursday, 25 February 2010, 02:00 AM
American Government
Next execution: Thursday, 25 February 2010, 02:00 AM
Manage Your Money!
Next execution: Thursday, 25 February 2010, 02:00 AM
American History 8
Next execution: Thursday, 25 February 2010, 02:00 AM
Intro to Family and Consumer Sciences
Next execution: Thursday, 25 February 2010, 02:00 AM
NEVA Course Format Ideas
Next execution: Thursday, 25 February 2010, 02:00 AM
External Web 2.0 Tools
Next execution: Thursday, 25 February 2010, 02:00 AM
9th Basic Math - Busby
Next execution: Thursday, 25 February 2010, 02:00 AM
Backup tasks finished.
Running rssfeeds if required...
Generating rssfeeds...
assignment: ...NOT SUPPORTED (file)
chat: ...NOT SUPPORTED (file)
choice: ...NOT SUPPORTED (file)
data: generating ...OK
forum: generating Updating RSS feed for Discussion on Interview Techniques (Quiz Grade) , ID: 399
Updating RSS feed for A Standard forum for general use, ID: 451
Updating RSS feed for A Standard forum for general use, ID: 499
Updating RSS feed for Unit forum, ID: 523
Updating RSS feed for Unit forum, ID: 524
Updating RSS feed for Unit forum, ID: 533
Updating RSS feed for A Standard forum for general use, ID: 999
...OK
glossary: generating ...OK
hotpot: ...NOT SUPPORTED (file)
journal: ...NOT SUPPORTED (file)
label: ...NOT SUPPORTED (file)
lams: ...NOT SUPPORTED (file)
lesson: ...NOT SUPPORTED (file)
quiz: ...NOT SUPPORTED (file)
resource: ...NOT SUPPORTED (file)
scorm: ...NOT SUPPORTED (file)
survey: ...NOT SUPPORTED (file)
wiki: ...NOT SUPPORTED (file)
workshop: ...NOT SUPPORTED (file)
feedback: ...NOT SUPPORTED (file)
dimdim: ...NOT SUPPORTED (file)
attforblock: ...NOT SUPPORTED (file)
elluminate: ...NOT SUPPORTED (file)
Ending rssfeeds......OK
Rssfeeds finished
Running auth crons if required...
...preventing stats to run, more than 4 hours since scheduled time.
Cron script completed correctly
Execution took 7.891609 seconds
1. You should disable your cronjob that calls /admin/cron.php(for now)
2. Go back into the database and reset all the values that Christopher mentioned (yes, again). Also make sure that your settings in Admin->Server->Statistics are properly configured.
3. call the cron via php /commandline (the stats should start processing)
4. if your cron.php is called via wget in the crontab, consider changing it to be called via php as with Christoper's example
5. make sure to reactivate the cron only after this job finishes (may take a while depending on the amount of logs to process)
Cheers,
-n
You can run it in your case within a 4 hour window timeframe (so it won't take a hit as it's intensive)
Toggle the enable stats (checkbox) in the admin section a couple of times and save it and then try the cron again.
I would even reset the statslastexecution to 0 if possible and don;t worry if it does not do all the days since November because your max days is only 31 days... then it would it another time.
do it manually first...
Some of the values are still 0. Is this correct, should they still be 0?
Moodle 1.9.5 (Build: 20090515)
+------+----------------------------+------------+
| id | name | value |
+------+----------------------------+------------+
| 42 | enablestats | 1 |
| 103 | statsfirstrun | all |
| 104 | statsmaxruntime | 14400 |
| 105 | statsuserthreshold | 0 |
| 127 | statsruntimestarthour | 0 |
| 128 | statsruntimestartminute | 45 |
| 229 | statsfirstrunlock | 0 |
| 231 | statslastdaily | 1261983600 |
| 232 | statslastweekly | 0 |
| 233 | statslastmonthly | 0 |
| 269 | statsrolesupgraded | 1175719586 |
| 414 | statscatdepth | 1 |
| 961 | statsruntimedays | 31 |
| 1000 | coursereport_stats_version | 2007101501 |
| 1004 | statslastexecution | 1267429513 |
| 1115 | statsrunning | 1267445276 |
+------+----------------------------+------------+
http://moodle.org/mod/forum/discuss.php?d=99899#p441613
then running cron manually is running the stats process ignoring the fact that it had already run in the past 20 hours.
we are on 1.9.5 as well, maybe this is fixed in later versions.
Note: setting stats settings to a bear minimum first to test and make sure it is running correctly then start incrementing the days etc..
My setup
Maximum processing interval = ALL
Maximum run time = 5 hours
Days to Process = 31
I am using Moodle 1.9.7 +
I tried to followed Christopher and Noveck's solutions above but to no avail. I set all the values mentioned with the exception of 'statsfirstrunlock' to '0'
(statsfirstrun, statslastdaily, statslastweekly, statslastmonthly, statslastexecution)
One thing that concerns me is that my database does not contain 'statsfirstrunlock' as you can see below:
mysql> select * from moodle.mdl_config where name like '%stat%';
+-----+----------------------------+------------+
| id | name | value |
+-----+----------------------------+------------+
| 2 | statsrolesupgraded | 1261119106 |
| 212 | enablestats | 1 |
| 213 | statsfirstrun | none |
| 214 | statsmaxruntime | 21600 |
| 215 | statsruntimedays | 7 |
| 216 | statsruntimestarthour | 0 |
| 217 | statsruntimestartminute | 25 |
| 218 | statsuserthreshold | 0 |
| 219 | statscatdepth | 0 |
| 322 | coursereport_stats_version | 2007101501 |
| 388 | resource_popupstatus | checked |
| 406 | scorm_status | 0 |
| 461 | statslastdaily | 1272146400 |
| 462 | statslastexecution | 1274740205 |
| 464 | statslastweekly | 0 |
| 465 | statslastmonthly | 0 |
| 540 | statsrunning | 1274783833 |
+-----+----------------------------+------------+
17 rows in set (0.00 sec)
I disabled the moodle cron, set Statistics to run for 6 hours and started it manually using php instead of wget.
8hrs later the site was still unusable with mysqld consuming 97% of the CPU so I had to restart MySQL.
The end of the cron output is below:
................ finished until 1271887200: Thursday, 22 April 2010, 12:00 AM (in 5513 s)
................ finished until 1271973600: Friday, 23 April 2010, 12:00 AM (in 5569 s)
................ finished until 1272060000: Saturday, 24 April 2010, 12:00 AM (in 5510 s)
................ finished until 1272146400: Sunday, 25 April 2010, 12:00 AM (in 5436 s)
..............error occured, completed 4 days of statistics.
Cron script completed correctly
Execution took 27366.902784 seconds
Strangely even though it claims to have finished 4 days in April - they are not available.
Administration ► Reports ► Statistics still says:
'There is no available data for that combination of course and time period.'
In addition, Stats was set to start at 12:30 AM and between 2:30 and 3AM I received 12 "Insert into log failed at your moodle site" emails.
Any advice will be greatly appreciated.
Heli
Thanks for getting back to me. I have been having MySQL performance problems for a while now - and regular "Insert into log failed at your moodle site" emails.
(also mentioned here http://moodle.org/mod/forum/discuss.php?d=146521 , http://moodle.org/mod/forum/discuss.php?d=113566#p610941)
We have lots of disk space (our database is currently using 1% of space available). I find that tables are frequently fragmented and I optimise them with PHPMyAdmin almost daily. I last ran myisamchk 10 days ago and the XMLDB editor reports no missing indexes.
I am tentatively trying to optimize MySQL following the recommendations of the MySQL Tuner and the Tuning Primer. Currently the main problems encountered are to do with the Joins, Temporary tables and the Query cache.
After MySQL has been up for only 8hrs:
[!!] Temporary tables created on disk: 34% (20K on disk / 58K total)
The Tuning Primer reported that the query cache was 23% fragmented so I have just flushed it - do you think this could be the problem?
Is there anything else I should do? I am very new to this side of Administration so I really appreciate any assistance.
Heli
FINAL SOLUTION:
to get statistics working 100% follow these steps:
1) open the file : moodle/lib/statslib.php and scroll down around line 90: and comment out the statements from :
if (isset($CFG->statslastexecution) and ((time() - 20*60*60) < $CFG->statslastexecution))
to the statement :
set_config('statslastexecution', time());
the last statement must be included (do not comment it)
2) go to Server->Statistics and enure that:
Statistics are enabled
Max Processing Interval: All
Max Runtime: until complete
Days to Process: (put any large number, for me I put 1000)
Run At: (set the clock for the current time)
and leave other settings as they are.
3) log in as admin and open the URL: /moodle/admin/cron.php
and wait until processing completes (it may take from minutes to several hours depending on site traffic)
4) go to : reports -> statistics -> and choose whatever you want, then submit, then enjoy the graph.
important note: this walkthrough is for people who want to see statistics effect right now, and how the graph and logs will look like, however, it's not a recommended approach for a heavy traffic moodle site.
@Fedora, if your cron.php page has problems finishing some tasks, open admin/cron.php file, and comment lines between two mtrace statements for the same job, you can comment all mtrace statements and leave the mtrace statemtment that belongs to statistics as is, if you do so, when you open the cron page from browser the statistics job will only work and any other cron jobs will be ignored
Rechecked our MOODLE version it is 1.99.10. Statistics has been enabled but processing is not occurring.
Enable statisticsenablestats
ok ...
did you try the second suggestion mentioned above, here it is:
"
@Fedora, if your cron.php page has problems finishing some tasks, open admin/cron.php file, and comment lines between two mtrace statements for the same job, you can comment all mtrace statements and leave the mtrace statemtment that belongs to statistics as is, if you do so, when you open the cron page from browser the statistics job will only work and any other cron jobs will be ignored"
if this does not work for you, give me admin access to your moodle site and FTP access to code (in a private message here), and I will run the statistics for you in minutes.
The "FINAL SOLUTION" above worked for me. There is an if, else if, else statement that says
- If the last run was less than 20 hours ago -> then dont run
- ELSE if it has been more than 4 hours since the scheduled time -> dont run
- Else if the above two statments are not true then go ahead and run.
So if the cron job has never been run before it gets caught up in this statement. Simply commenting out the if statement (lines 120-129 in Moodle 2.0 lib/statslib.php) and leaving the statment:
set_config('statslastexecution', time()); /// Grab this execution as last one
un commented, it will run for the first time witout issue. I have yet to test if it will run on its own after the first time if I uncomment the code that I commented.
P.S. I ended up setting up a cron job on my server to handle cron.php
I got the same problem with a clean install of 1.9.10 + direct upgrade to 1.9.13.
I have logged in as a student, made some quizes and after that ran the statistics. Statistic tables are filled with some data. However, I recieve the Sorry, there is no available data to display as well.
Stack trace:
- line 5889 of lib/weblib.php: call to debugging()
- line 21 of course/report/stats/report.php: call to print_error()
- line 72 of course/report/stats/index.php: call to require()
Hi, I am on 2.0.3 and my statistics aren't working.
They are enabled.
I did the DB check and get all the ok's as above (see below):
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
But I do not have the following fields in my DB; statsfirstrunlock, statslastdaily, statsruntimestarthour, and statsruntimestarminute, so I can not change them to 0.
The cron is working as I tried the test /admin/cron.php and get:
"Cron script completed correctly
Execution took 1.177381 seconds"
Can anyone suggest anything?
Thanks
Hi guys,
I am just wondering, my statistics is not working, although I tried out the described solutions.
I thought, that moodle was working just with normal site administration?
Why do I have to tweek php files and manipulate the database entries?
Does this mean, that the statistics functions of moodle are not working?
Statistics is something substantial, but obviously I need to be a php programmer to make it working. Why dont you distribute SW which was tested and is working?
Manfred
Hi
We are currently running Moodle 1.9.3 on hosting site and it’s been working fine for us over 5 years. Hopefully upgrade over the summer to 2.0.
In the past I was having trouble with my stats not updating/processing and by following this forum I got them running again.
However we got upgraded to a new professional server to improve performance on the site and since then our stats have stopped running. I have followed everything that I did before and I still can’t get this to update.
In Notifications area it states that the cron.php maintenance script has been completed in over 24 hrs. I can run it normally from the address bar admin/cron.php and it will update some stats manually. However the next day the message appears again.
I contacted the hosing company and they say the cron jobs are working.
Here are my cron commands
*/5 * * * * cd '/home2/stcather/public_html/moodle/admin/' ; /ramdisk/bin/php5 -q 'cron.php' > /dev/null ;
They asked me to change it to the following
*/5 * * * * /ramdisk/bin/php5 -q /home2/stcather/public_html/moodle/admin/cron.php >/dev/null 2>&1
Still didn’t make a difference.
Any help appreciated
Have you tried using php rather than php5. In fact try using php rather than * * * * /ramdisk/bin/php5
My php is the latest version but the installer stopped separating the php5 version in some time ago.
Alternatively, try the other version where you so a command line get on the file using (from the 1.9 cron.php script)
wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
OK i have used the following code
wget -q -O /dev/null 'http://ouraddressinhere/admin/cron.php'
the message that kept on appearing every day regarding the maintence script hasn't ran in 24hours is gone.
and im starting to get backup summary emails again which is a good start. However my stats still will not update. I have just changed the Maximum processing interval to the last 4 months as it was set to all.
However when i click on stats on a user profile i get the following message.
I check back on this tomorrow to see if it changes
My Cron jobs are running now however my Stats are not updating.
I have tried all suggestions from above and still not getting anywhere.
Database test results all comeback as ok, i have reset the values to 0 nothing. any other suggestions would be great. Need to have some stats in for the boss soon.
Hello,
Thank you for the solutions, I followed the steps and statistics seems to work fine.
However, I can see course statistics only for the last month. Is there any chance to have them for the last 3 months, for exemple?
I set statsfirstrun to 4 months, statsruntimedays to 120 but when I go to the statistic page the statistics shown are limited to 4 weeks. We are working on 2.0 version.
Thank you.