Commit 478e2627 authored by Jonathan Michalon's avatar Jonathan Michalon

Few cosmetics (comment, pep8)

parent 404d2f91
......@@ -33,5 +33,5 @@ config.install_attr('emails.report.every', 0)
# parameter)
config.install_attr('emails.subject_tpl',
'[DOMAIN] {state}: {check} on {dest}')
# 0 disables reports
# reports email subject
config.install_attr('emails.report.subject', '[DOMAIN] Picomon error report')
......@@ -89,6 +89,7 @@ def _send_email(subject, body, extra_headers={}):
_mailer.sendmail(config.emails.addr_from, config.emails.to,
msg.as_string())
def send_email_for_check(check):
from . import config
# ensure we do not traceback with unknown substitutions
......@@ -103,7 +104,7 @@ def send_email_for_check(check):
msg_text += ("Check %s failed:\n%s" %
(str(check), check.errmsg.strip()))
extra_headers={}
extra_headers = {}
extra_headers['Message-ID'] = make_msgid(type(check).__name__)
# if check is OK it's a follow up, so set In-Reply-To
if check.ok and hasattr(check, 'mails_msgid'):
......
......@@ -25,11 +25,13 @@ def create_report():
return (report, has_error)
def usr1_handler(signum, frame):
(report, err) = create_report()
print ("Signal SIGUSR1 caught, printing state of checks.")
print (report)
def alarm_handler(signum, frame):
(report, err) = create_report()
if err:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment