Holger Frey 5 years ago
parent
commit
8b2bcf9253
  1. 18
      s2watchdog/__init__.py

18
s2watchdog/__init__.py

@ -9,6 +9,7 @@ send an email if the system is not available (network down or power failure). @@ -9,6 +9,7 @@ send an email if the system is not available (network down or power failure).
import json
import requests
import sys
from datetime import datetime
@ -17,19 +18,28 @@ from . import pysema @@ -17,19 +18,28 @@ from . import pysema
# alert emails recipients, subject and message
EMAIL_RECIPIENTS = ['frey@imtek.de']
EMAIL_RECIPIENTS = [
'brandstetter@imtek.uni-freiburg.de',
'ute.riede@imtek.uni-freiburg.de',
'samora.okujeni@imtek.uni-freiburg.de',
'felix.juenger@imtek.de',
'enderle@imtek.de',
'huegle@imtek.de',
'huber@imtek.de',
'frey@imtek.de'
]
EMAIL_SUBJECT = '[S2 Scullery]: Deep Freezer Alert System Is Offline'
EMAIL_BODY = [
'The -80 alert system in the S2 scullery seems to be offline.',
'Maybe the network is down, there is a power outage or the system crashed.',
'',
'>>> Please have a look as soon as possible. <<<',
'==> Please have a look as soon as possible. <==',
'',
'The system was last seen on {} (UTC)'
]
# which url to check
ALERT_SYSTEM_URL = 'http://echo.cpi.imtek.uni-freiburg.de'
ALERT_SYSTEM_URL = 'http://10.3.182.139'
# How many times can an error be ignored?
@ -126,7 +136,7 @@ def run(): @@ -126,7 +136,7 @@ def run():
data['emails_sent'] = data['emails_sent'] + 1
data['time_to_live'] = GRACE_PERIOD * data['emails_sent']
send_alert_mail(data)
print("SEND MAIL")
# print("SEND MAIL")
else:
data['time_to_live'] = ttl

Loading…
Cancel
Save