-2

I use the unattended-upgrades package on my Debian Google Compute Engine instance to do security updates. It has the option of sending an email to notify me when a security upgrade was done. Do I need to go through the 3rd party bulk email services just to notify myself, or is there an easier way?

On google app engine, it was easy to do this via:

from google.appengine.api import mail
mail.send_mail(....

which generated an email coming from cron@cron-1022.appspotmail.com. I was hoping there was something correspondingly simple on compute engine.

I'd actually like to setup notifications / emails on other custom security events on my server.

Thanks.

0

I figured out a way to do send an email alert. First, enable Stackdriver error reporting.

Stackdriver expects errors that look like stack traces. And it triggers email alerts only for 'new' errors. So to fake out stackdriver, I encode the current date in the function name of a fake stack trace. This means I'll get at most one email per day. Then, for example from a shell, I can report an error:

gcloud beta error-reporting events report --service nodeapp --service-version 1 --message "Error: something bad happened
    at date-`date +%F`-func (tfile.js:2:1)"

Note, the '\n at' and then ' (tfile.js:2:1)' in the message quotes. Something like it is necessary to fake stackdriver into thinking it's a stack trace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.