Browse Source

changed to correct monitoring settings of ip and recipient list

master^2
Holger Frey 6 years ago
parent
commit
57302f0b0c
  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).
import json import json
import requests import requests
import sys
from datetime import datetime from datetime import datetime
@ -17,19 +18,28 @@ from . import pysema
# alert emails recipients, subject and message # 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_SUBJECT = '[S2 Scullery]: Deep Freezer Alert System Is Offline'
EMAIL_BODY = [ EMAIL_BODY = [
'The -80 alert system in the S2 scullery seems to be offline.', '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.', '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)' 'The system was last seen on {} (UTC)'
] ]
# which url to check # 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? # How many times can an error be ignored?
@ -126,7 +136,7 @@ def run():
data['emails_sent'] = data['emails_sent'] + 1 data['emails_sent'] = data['emails_sent'] + 1
data['time_to_live'] = GRACE_PERIOD * data['emails_sent'] data['time_to_live'] = GRACE_PERIOD * data['emails_sent']
send_alert_mail(data) send_alert_mail(data)
print("SEND MAIL") # print("SEND MAIL")
else: else:
data['time_to_live'] = ttl data['time_to_live'] = ttl

Loading…
Cancel
Save