matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.65k stars 2.62k forks source link

Add feature to receive an email when an error happens during cron archiving (cron:archive command) #17210

Open bbodenmiller opened 3 years ago

bbodenmiller commented 3 years ago

Expected Behavior

Per https://matomo.org/docs/setup-auto-archiving/#linux-unix-how-to-set-up-a-crontab-to-automatically-archive-the-reports when MAILTO environment variable is set before running core:archive it is supposed to send an email if archive fails. Have verified mail settings are set correctly as other emails from Matomo are working.

Current Behavior

core:archive is failing and the emails are not being sent.

Possible Solution

Steps to Reproduce (for Bugs)

  1. Setup cron job to run export MAILTO='me@domain.com' && console core:archive --url=https://matomo.domain.com
  2. Do something to make job fail
  3. Verify job ran and failed
  4. See that email is never received

Context

Your Environment

tsteur commented 3 years ago

Hi @bbodenmiller

Just to verify: does your crontab look like there and mailto is on its own line?

image

MAILTO is a crontab feature, not a Matomo feature so I don't think using export and running it on command line like above would work unfortunately.

bbodenmiller commented 3 years ago

Interesting. I thought it was Matomo feature. I'm using https://docs.pivotal.io/scheduler/1-2/index.html for scheduling which must not support this feature. Looks like it wouldn't work for windows either.

tsteur commented 3 years ago

@bbodenmiller is there maybe a way to use regular crontab or so? I'll meanwhile rename this issue to describe it as a new enhancement (as it's not a bug)