I was just about to ask the same. Our user can send reports manually, but the automation doesn’t work. I scanned the maillog for yesterday (Monday) and there is no noreply@piwik. So, there isn’t even a failed try. There’s also nothing in the php error log. What is supposed to trigger those mails or where could I start troubleshooting this? Thanks!
I have attempted some debugging. website triggered archiving is off here, so archive.sh should trigger this. I get the following errors/output when running it. Oops, actually I get an error or a success depending on time:
Zend_Session is currently marked as read-only. This error stems from just running the index.php After the htmlified error there is another error from the Zend Framework:
Error: Action redirect not found in the controller Piwik_API_Controller.Error: Action redirect not found in the controller Piwik_API_Controller.Finished Scheduled tasks. The command line in this case is:
<…>/index.php module=API&method=CoreAdminHome.runScheduledTasks&format=csv&convertToUnicode=0&token_auth=error page here! Notice the missing $TOKEN_AUTH at the end.
It appears that if Zend_Session is read-only, it can’t get required data and thus fails. Which means archive.sh may not run correctly from time to time!
No data availableFinished Scheduled tasks. In this case the $TOKEN_AUTH is filled in.
However, it doesn’t find any scheduled tasks. As we know the superuser cannot list other user’s PDF reports. Is it really possible that this is the simple explanation for this problem? I do not want to believe that.
So I added a report for the superuser. Still no go. It still has “No data available”. Where do I find these data for further troubleshooting? Data in table piwik_pdf looks good. If that is the data it’s looking for …
I was running the script as root. Furthermore, I do not get this message all the time. I was getting it when I started testing, not later. So, with all respect, this explanation doesn’t look right to me.
Why is it then retrieving and using the token?
What “data” exactly is it looking up?
Also, keep in mind, that it is apparently able to archive, but cannot get data for the reports.
Is there a way to get a backtrace? Anyway, I think the real problem is not the session read-only thing. I think that appears temporarily. The problem is that when it runs thru it thinks there is no scheduled tasks and I don’t know how to troubleshoot that :S
Ok, I accidentally found the source of the problem. Still no fix, though. I checked tmp/sessions and when walking up I found several PDF reports in tmp. I grepped the maillog for the time and found the sending attempts. The reports get sent with a reply address of noreply@unknown which is rejected because it is not an FQDN. Very well. However, the manual reports do get sent out with an FQDN. So, the question is why? The manual reports are sent with noreply@webhost-FQDN. I think the script has a problem to identify the hostname, probably it uses $_SERVER[‘HOSTNAME’] and that is bound to fail on the shell/cron. The script should be fixed to always identify a correct hostname and while I think about the “noreply” thing I think it would be best if you added a configurable option to set a sender address, preferably on a per website basis. Shall I open a bug for it?
While I’m in the tmp area I found that sessions is filled with plenty of sessions files mostly or exclusively from Jan 4/5/6/7. Shouldn’t these have been cleaned away? I did my update to 1.1.1 around that time. Is there a chance this stopped the cleaning for these files?
As I said above there’s also those PDF reports sitting in tmp. I assume they didn’t get cleaned because the send failed?
Reply-To is of no interest to this. The SMTP connection is done with an envelope TO and FROM, Reply-To is just another header in the data section. I’ll have a look at Mail.php later, thanks for the pointer to it. The problem must be that you simply cannot pick up a valid hostname when not running in a webhost environment.
and it connects with that FROM string.
As I said, if run from cron/shell it cannot pick up a hostname. $piwikhost is probably filled from $_SERVER and that is not available on the shell. You would have to pick up $_ENV[‘HOSTNAME’] or (better in my eyes) an email address that is set in options.
This will set the machine hostname which most often is not the same as the webhost hostname. But it will suffice for now.
As I said I think the best solution is to let people configure that themselves, preferably on a per website basis, so they can set their preferred address.
Also, I recognize that it doesn’t take the PDF report title (Description). I think the title should appear either as the FROM name or in the subject.
Uhm, where/how should I report translation bugs? The German translation for “Daily” is used incorrectly in this context and looks rather weird. “Täglich” is an adverb, not an adjective and adjectives have to be declined for each single case. Also, you cannot use uppercase here (this applies to the English as well I think, it should be lowercase here). So, in this case it has to be “täglicher” and not “Täglich”. I assume there is a “Daily” where the translation “Täglich” is absolutely correct in the original context and which gets now reused everywhere, including in the middle of sentences. You can’t do this in many languages, most languages are more complex than English in this respect. You have to take the whole sentence and translate it.