Statistics not working

Statistics not working

Bill Parsons -
回帖数:60
I'm running Moodle 1.9.2. I've read everything here so far on Statistics problems. None seem to work for me. I've attached a picture of the mySQL config table showing my current values for the statistics fields. I run CRON daily. My LOGS work fine.

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


附件 MoodleStats.gif
回复Bill Parsons

Re: Statistics not working

Scott Karren -
Bill

Are you getting a specific error or message when you try to look at Administration > Reports > Statistics?

Scott Karren
回复Scott Karren

Re: Statistics not working

Bill Parsons -
No. I simply get "There is no available data for that combination of course and time period." It doesn't matter what "time period" I select, I get this message.

Bill
回复Bill Parsons

Re: Statistics not working

Scott Karren -

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

回复Scott Karren

Re: Statistics not working

Bill Parsons -
Thanks Scott. However, I can only use a .htaccess file to send php settings to my web host (commercial). So, I tried sending the command date.timezone ='American/Denver' and it took the site down. When I removed the line the site was back up. I don't know what's going on.
回复Scott Karren

Re: Statistics not working

Bill Parsons -
I discovered that my Cron job is running statistics. However, they are running for dates about 4th months prior to the current date. Here is a sample my Cron log showing the dates for the Statistics run. Can anyone help me solve this problem. I checked the date (time zone) on my Moodle server and have it correct. See below that the dates are in May and June... not current.

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.
回复Bill Parsons

Re: Statistics not working

Nathan Cobb -
Hi

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?
回复Nathan Cobb

Re: Statistics not working

Raquel Hijon -

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

回复Raquel Hijon

Re: Statistics not working

Caroline Briggs -

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?big grin

回复Caroline Briggs

Re: Statistics not working

ankit garg -

Sorry, there is no available data to display when click on report/statistics or course overview even after enabling the statistics from server section. any idea...........

回复ankit garg

Re: Statistics not working

Baruch Sienna -
Just to chime in- we have not been able to get statistics working, and just upgraded to the latest 1.9.4 build, but still no luck. We would very much appreciate someone helping us figure out why there is nothing to report! We see the cron job does backups:

Backup tasks finished.
Running auth crons if required...
...preventing stats to run, more than 4 hours since scheduled time.
Cron script completed correctly
回复Baruch Sienna

Re: Statistics not working

Marjan Milošević -
Same problem 伤心 I checked time settings and it is set fine, both server's and PHP's...
回复Marjan Milošević

Re: Statistics not working

Teresa Gibbison -
We're also seeing "There is no available data for that combination of paper and time period." no matter what options are selected. We are using Moodle 1.9.4+ (Build: 20090310), our Stats settings are:
Enabled
Max processing - 6 months
Max runtime - until complete
Days to process - 31
Run at - 23:55pm
User threshold - 0
Max parent categories - 2
I've found a Tracker Issue MDL-16415 which I'm watching and have voted for, take a watch & vote for it - the more votes the higher up the list it goes!!
Cheers
Teresa
回复Bill Parsons

Re: Statistics not working

HJWUCGA INC. -
Hello everyone.

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 big grin
回复HJWUCGA INC.

Re: Statistics not working

Eric Kemsley -

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

回复Eric Kemsley

Re: Statistics not working

Noveck Gowandan -
I think I solved the Statistics not working issue (at least for me)

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

回复Noveck Gowandan

Re: Statistics not working

HJWUCGA INC. -
Yes that is the key..

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.
回复Noveck Gowandan

Re: Statistics not working

Eric Kemsley -

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 |
+------+----------------------------+------------+

回复Eric Kemsley

Re: Statistics not working

HJWUCGA INC. -
Basic sql statement will do just fine for each field.

update mdl_config
set value = '0',
where id = '231'

* check first to make sure that 231 is statslastdaily and then you can update safely

* > select id, name, value from mdl_config where where id = '231';

> flush privileges;







回复HJWUCGA INC.

Re: Statistics not working

Eric Kemsley -
Thank you Christopher
回复Eric Kemsley

Re: Statistics not working

Eric Kemsley -
The stats still don't work. Any other ideas?
附件 stats.png
回复Eric Kemsley

Re: Statistics not working

HJWUCGA INC. -
Did you try running the moodle cron via command line?

output the results to a text file ... something like this and see what the bottom says..

/usr/bin/php /var/www/mysites/moodle/admin/cron.php > /home/elvis/checklog.txt

adjust to the path of your php accordingly ...
回复HJWUCGA INC.

Re: Statistics not working

Eric Kemsley -


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

回复Eric Kemsley

Re: Statistics not working

Noveck Gowandan -
Hi Eric.

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



回复Noveck Gowandan

Re: Statistics not working

HJWUCGA INC. -
Yes... it's all about timing actually.

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...
回复HJWUCGA INC.

Re: Statistics not working

Eric Kemsley -
Stats are still nott working. Any other thoughts?
回复Eric Kemsley

Re: Statistics not working

Eric Kemsley -

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 |
+------+----------------------------+------------+

回复Eric Kemsley

Re: Statistics not working

Cathal McLeod -

Hi Eric

Was wondering did you ever get this issue fixed.  Im having the same problem.

Need to have a report done on moodle within the next week.  I have tried the suggestions above but nothing seems to work.

I have 442 day to process only 96 were done. It stays at 96 all the time.

回复Eric Kemsley

Re: Statistics not working

HJWUCGA INC. -
I forgot to add ... wait for at least 4 hours and try the manual call to cron.php again... you can run the stats when you call it again... technically you could but you'll have to change the codebase wink ... which is not a good thing if you have heavy usage
回复Eric Kemsley

Re: Statistics not working

HJWUCGA INC. -
Don't worry because the stats are only allowed to run X number of times for a given period and can be db intensive. wait until the next day or so.
回复HJWUCGA INC.

Re: Statistics not working

Simon Allison -
I found that changing statsexecution to zero and statsdaily to 0

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




回复Simon Allison

Re: Statistics not working

heli g -
My Moodle is a single server installation, OS SLES 10.2 on VMWare. The VMWare hardware went down on 14 April due to lack of memory - and Moodle has not generated statistics since then.

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:

Running daily statistics gathering, starting at 1271800800:
................ 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
回复heli g

Re: Statistics not working

HJWUCGA INC. -
Heli,

Check your drive space... is it full?

Did you try to reindex the tables? there may be a corruption.

next, go to your moodle admin page and just set the stats to run no more than 1 day at a time. Do it slowly so it could catch up.


回复HJWUCGA INC.

Re: Statistics not working

heli g -
Hi Christopher,

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:
[!!] Joins performed without indexes: 3093
[!!] 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
回复heli g

Re: Statistics not working

SVI eSolutions -

Hi, I acctivated my statistics some time back but I still get the message that there are no stats avaiblable.

I am in Moodle 2.0.2, the table names match the ones mentioned above but not the field names mentioned in the mdl_config that need to be put to 0.

Can anyone help?

回复Bill Parsons

Re: Statistics not working

Murad Jamal -

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.

回复Murad Jamal

Re: Statistics not working

Jaswant Tak -

Thanks Murad,

For this detailed resolution. FInally it works.

cheers,

jaswant

回复Jaswant Tak

Re: Statistics not working

Fedora Core -

i already follow step by step but it still having problem.error message that appear

"There is no available data for that combination of course and time period."

Please help me.I really need this statistic for my report to my superior.

 

回复Fedora Core

Re: Statistics not working

Murad Jamal -

if you really followed my approach above exactly, the stats must work for you ...

if it did not work, that means, nobody tried to login or use your moodle site at all, that's why there is no stats ...

回复Fedora Core

Re: Statistics not working

Murad Jamal -

@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

回复Murad Jamal

Re: Statistics not working

Justin Hyde -

Rechecked our MOODLE version it is 1.99.10. Statistics has been enabled but processing is not occurring.

Enable statisticsenablestats

Default: No
If you choose 'yes' here, Moodle's cronjob will process the logs and gather some statistics.  Depending on the amount of traffic on your site, this can take awhile. If you enable this, you will be able to see some interesting graphs and statistics about each of your courses, or on a sitewide basis.
Maximum processing intervalstatsfirstrun
None1 weeks2 weeks3 weeks1 months2 months3 months4 months5 months6 monthsAll
Default: None
This specifies how far back the logs should be processed the first time the cronjob wants to process statistics. If you have a lot of traffic and are on shared hosting, it's probably not a good idea to go too far back, as it could take a long time to run and be quite resource intensive. (Note that for this setting, 1 month = 28 days. In the graphs and reports generated, 1 month = 1 calendar month.)
Maximum runtimestatsmaxruntime
Until complete30 minutes1 hour2 hours3 hours4 hours5 hours6 hours7 hours8 hours
Default: Until complete
Specify the maximum time allowed to calculate the statistics for one day, bearing in mind that stats processing can put a big load on the server. The maximum number of days processed in one cron can be specified below.
Days to processstatsruntimedays
Default: 31
Specify the maximum number of days processed in each stats execution. When stats are up-to-date, only one day will be processed, so adjust this value depending of your server load, reducing it if shorter cron executions are needed.
Run atstatsruntimestarthour
01234567891011121314151617181920212223:0510152025303540455055
Default: 0:0
What time should the cronjob that does the stats processing start? Please specify different times if there are multiple Moodles on one physical server.
User thresholdstatsuserthreshold
Default: 0
If you enter a non-zero,  non numeric value here, for ranking courses, courses with less than this number of enrolled users (all roles) will be ignored
Maximum parent categoriesstatscatdepth
0123456
Default: 1
Statistics code uses simplified course enrolment logic, overrides are ignored and there is a maximum number of verified parent course categories. Number 0 means detect only direct role assignments on site and course level, 1 means detect also role assignments in parent category of course, etc. Higher numbers result in much higher database server load during stats processing.
 
This is what the stats off admin shows. How can I get to the cron.php files?
 
Thanks
回复Justin Hyde

Re: Statistics not working

Murad Jamal -

@Justin, your question is not clear ... however, if you want to get statistics working try the solution above .. titled "Final Solution" ...

回复Murad Jamal

Re: Statistics not working

Justin Hyde -

Hi Murad

We tried the solution you gave. Unfortuantely, still not working, and giving the same pink box message. "Sorry there is no available data to display." Any ideas?

Thanks Justin

 

回复Murad Jamal

Re: Statistics not working

Justin Hyde -

Hi Murad

Tried your suggestion. I have gone through the logs for my course. We are only getting activity report hits, live logs, but no stats still. Our version is 1.99.10.

Any other ideas?

回复Justin Hyde

Re: Statistics not working

Murad Jamal -

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.

回复Murad Jamal

Re: Statistics not working

Rachel Dotey -

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

回复Rachel Dotey

Re: Statistics not working

Murad Jamal -

if your server has met the criteria of the IF ELSEIF ELSE block listed above it must run on its own after the first time ... if It didn't run, please post the problem here ..

回复Murad Jamal

Re: Statistics not working

Duo Pen -

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()
Anyone got an idea of the problem?
 
回复Duo Pen

Re: Statistics not working

Murad Jamal -

look at the "FINAL SOLUTION" reply above ...

回复Murad Jamal

Re: Statistics not working

SVI eSolutions -

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

回复SVI eSolutions

Re: Statistics not working

manfred stelzer -

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

回复manfred stelzer

Re: Statistics not working

Cathal McLeod -

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

回复Cathal McLeod

Re: Statistics not working

Brian Lockwood -

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'

 

回复Brian Lockwood

Re: Statistics not working

Cathal McLeod -

i get an email that says the following

 

/bin/sh: /ramdisk/bin/php: No such file or directory

回复Cathal McLeod

Re: Statistics not working

Brian Lockwood -

What about using the wget version from another server?

回复Brian Lockwood

Re: Statistics not working

Cathal McLeod -

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.

Statistics is currently in catchup mode. So far 161 day(s) have been processed and 47 are pending. Check back soon!
 

I check back on this tomorrow to see if it changes

回复Cathal McLeod

Re: Statistics not working

Cathal McLeod -

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.

回复Cathal McLeod

Re: Statistics not working

Cathal McLeod -

All working again thanks.

Took a while but i'm not sure how but i'm glad it is.

回复Cathal McLeod

Re: Statistics not working

Irina Yastrebova -

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.