Skip to content

Commit

Permalink
Correct bug email ticket_id
Browse files Browse the repository at this point in the history
The website monitoring notification email is showing the outdated "rtir" variable instead of the correct "ticket_id" variable.
  • Loading branch information
Felix83000 authored Jul 26, 2024
1 parent 220d361 commit 29d4ed6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Watcher/Watcher/site_monitoring/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def create_alert(alert, site, new_ip, new_ip_second, score):
time.sleep(random.uniform(1, 3))

# Send an email for the alert
send_email(alert_data['type'] + " on " + site.domain_name, site.rtir, new_alert.pk)
send_email(alert_data['type'] + " on " + site.domain_name, site.ticket_id, new_alert.pk)

# Manage MX records for mail changes
if 'Mail' in alert_data['type']:
Expand Down Expand Up @@ -417,13 +417,13 @@ def create_alert(alert, site, new_ip, new_ip_second, score):
mail_A_record_ip=site.mail_A_record_ip,
mail_A_record_ip_second=site.mail_A_record_ip_second)

def send_email(message, rtir, alert_id):
def send_email(message, ticket_id, alert_id):
"""
Send Email alert.
:param alert_id: Alert ID.
:param message: Subject email end message.
:param rtir: Identification number of RTIR.
:param ticket_id: Identification number for the case managment software.
:return:
"""
emails_to = list()
Expand All @@ -433,12 +433,11 @@ def send_email(message, rtir, alert_id):

# If there is at least one subscriber
if len(emails_to) > 0:
# RTIR Ticket
try:
msg = MIMEMultipart()
msg['From'] = settings.EMAIL_FROM
msg['To'] = ','.join(emails_to)
msg['Subject'] = "[" + settings.EMAIL_SUBJECT_TAG_SITE_MONITORING + " #" + str(rtir) + "] " + message
msg['Subject'] = "[" + settings.EMAIL_SUBJECT_TAG_SITE_MONITORING + " #" + str(ticket_id) + "] " + message
body = message
body += u"""\
Alert ID: """ + str(alert_id)
Expand Down

0 comments on commit 29d4ed6

Please sign in to comment.