Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inconsistent email reports function #13774

Closed
snomisneb opened this issue Nov 28, 2018 · 11 comments
Closed

inconsistent email reports function #13774

snomisneb opened this issue Nov 28, 2018 · 11 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@snomisneb
Copy link

The Personal Email Reports function is inconsistent on my system.
I’ve scheduled 2 reports @ 8 o'clock UTC.
Sometimes I receive reports @ 9:09 or 10:43 but mostly I do not receive any reports al all.
The scheduler is not working as it supposed to be. Is there anything I can do or check?

I’m running Matomo 3.7.0 on Ubuntu 16.04 with Apache and MariaDB.

@Findus23
Copy link
Member

Hi,

Quick question: Do you habe cron set up?

@snomisneb
Copy link
Author

Nope!
I am familiar with crons but how can I set this up for Matomo?

@Findus23
Copy link
Member

PHP programs don't run permanently, but just when they are accessed. So the only times when Matomo can do something is when e.g. you log into Matomo or someone visits your website. Then Matomo aggregates the raw data and does scheduled tasks.

If you want reports to be already generated when you access Matomo and emails to be sent on time, you can instruct your server to call Matomo in regular intervals. On Linux (and co.) this can be done with the great tool cron (on Windows there is a similar Tool).

How exactly you do this depends a lot on your Server environment, but the most popular ones are explained here:
https://matomo.org/docs/setup-auto-archiving/#windows-how-to-set-up-auto-archiving-using-windows-scheduler

@Findus23 Findus23 added the answered For when a question was asked and we referred to forum or answered it. label Nov 28, 2018
@tsteur
Copy link
Member

tsteur commented Nov 28, 2018

As @Findus23 pointed out you will need to set up a cronjob to run for example hourly (recommended) and ideally also disable browser archiving as mentioned in the guide (will also give your Matomo a performance boost). Let us know if this doesn't fix your problem.

@tsteur tsteur closed this as completed Nov 28, 2018
@snomisneb
Copy link
Author

@Findus23

I run many shell scripts on my Linux machines via cron.
Do I need to run the following task hourly via cron to fix my scheduled tasks?

/usr/local/bin/php -f /home/yourcpanelsitename/public_html/piwik/console core:archive --url=example.org/piwik/ > /home/example/piwik-archive-output.log

@Findus23
Copy link
Member

@snomisneb Exactly But of course with the correct php path, matomo path and url.

@snomisneb
Copy link
Author

@Findus23

Of course, I will give it a try today.
Thanks for your help so far.

@snomisneb
Copy link
Author

@tsteur @Findus23

I have had the email report-scheduler working for some time due to the archive-cron setup but now I’m struggling again on a new server (Ubuntu 18.04).
I have setup the same archive-cron, but I can’t get it to work on the new Ubuntu 18.04 server.
The manual-email-report function works fine. I’m searching for a solution now for 2 weeks but I’m out of options and hope you can help me again.
I guess this has something to-do with PHP 7.2.

@tsteur
Copy link
Member

tsteur commented Dec 27, 2018

Check all kind of webserver and PHP error logs to see if you find something in there. You might also want to enable the file logger to see if some error occurs in Matomo https://matomo.org/faq/troubleshooting/faq_115/

@snomisneb
Copy link
Author

@tsteur,

I’m scanning all logs on a daily basis for about 2 weeks now, but I can’t find any problems.

Below some small snippets of the Matomo-cronjob-log.

INFO [2018-12-28 07:00:02] 28757 SCHEDULED TASKS
INFO [2018-12-28 07:00:02] 28757 Starting Scheduled tasks...
INFO [2018-12-28 07:00:02] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_8...
INFO [2018-12-28 07:00:05] 28757 Scheduler: finished. Time elapsed: 3.168s
INFO [2018-12-28 07:00:05] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_9...
INFO [2018-12-28 07:00:08] 28757 Scheduler: finished. Time elapsed: 2.393s
INFO [2018-12-28 07:00:08] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_10...
INFO [2018-12-28 07:00:09] 28757 Scheduler: finished. Time elapsed: 1.772s
INFO [2018-12-28 07:00:09] 28757 Scheduler: executing task Piwik\Plugins\ScheduledReports\API.sendReport_11...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 1.056s
INFO [2018-12-28 07:00:10] 28757 Scheduler: executing task Piwik\Plugins\CustomPiwikJs\Tasks.updateTracker...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 0.002s
INFO [2018-12-28 07:00:10] 28757 Scheduler: executing task Piwik\Plugins\PrivacyManager\Tasks.anonymizePastData...
INFO [2018-12-28 07:00:10] 28757 Scheduler: finished. Time elapsed: 0.000s
INFO [2018-12-28 07:00:10] 28757 done

I have enabled PHP error logging on the machine, but this logfile is still empty.
The Apache2 access and error logs also look fine.

Do you know which PHP packet is responsible for the scheduled reports?
I know the PHP-mcrypt package isn’t in the PHP 7.2 repositories.

@tsteur
Copy link
Member

tsteur commented Dec 30, 2018

Not sure what you mean by "PHP packet"? We simply use http://us2.php.net/manual/en/function.mail.php AFAIK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants