-
Notifications
You must be signed in to change notification settings - Fork 14
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
habitat daemons should mail us when there's an unhandled exception #197
Comments
See first code snippet in http://flask.pocoo.org/docs/errorhandling/ : add a SMTPHandler to the standard python logging object; job done. Errors now get mailed to you. Trivially added to config and startup.setup_logging |
|
also good would be a supervisord event listener ( http://supervisord.org/events.html#example-event-listener-implementation ) that emails us if a daemon stops, fails to start, e.t.c. |
This is done for the parser and spacenearus daemons (pending deployment) but is still TODO for calendar, transition, maybe couch named python and the supervisord event listener thing. |
dug through the code and found this snippet in ~habitat/old/habitat-calendar/blah/cal.py; saving it here in case it's lost in spring cleaning or something +ADMINS = ['[email protected]', '[email protected]']
+if not app.debug:
+ import logging
+ from logging.handlers import SMTPHandler
+ mail_handler = SMTPHandler('127.0.0.1', '[email protected]', ADMINS
+ 'calendar error')
+ mail_handler.setLevel(logging.ERROR)
+ app.logger.addHandler(mail_handler)
+
+ @app.route("/test_error")
+ def test_error():
+ raise AssertionError("This is a test error message") Though we should probably import and use habitat.setup_logging instead somehow with the global habitat.yml file (yay). |
http://pypi.python.org/pypi/superlance provides 'crashmailbatch' and 'failmailbatch' which do pretty much exactly what we want for a supervisord event listener. |
superlance deployed. Config was: [eventlistener:crashmailbatch]
user=nobody
command=/opt/superlance/bin/crashmailbatch -t [email protected] -f [email protected]
events=PROCESS_STATE,TICK_60
[eventlistener:fatalmailbatch]
user=nobody
command=/opt/superlance/bin/fatalmailbatch -t [email protected] -f [email protected]
events=PROCESS_STATE,TICK_60 |
🆒 👍 |
List of daemons/things that might need to email us Done:
Not done:
|
Couch view server being able to email us would be suicide. Maybe we want to investigate one of:
|
see habitat/utils/immortal_changes.py
The text was updated successfully, but these errors were encountered: