fixed reporting sections

This commit is contained in:
Jokob-sk
2022-12-11 16:17:36 +11:00
parent 4ad406a8c3
commit 0f8f3eca81

View File

@@ -1396,8 +1396,6 @@ def email_reporting ():
json_down_devices = [] json_down_devices = []
json_events = [] json_events = []
# Disable reporting on events for devices where reporting is disabled based on the MAC address # Disable reporting on events for devices where reporting is disabled based on the MAC address
sql.execute ("""UPDATE Events SET eve_PendingAlertEmail = 0 sql.execute ("""UPDATE Events SET eve_PendingAlertEmail = 0
WHERE eve_PendingAlertEmail = 1 AND eve_EventType != 'Device Down' AND eve_MAC IN WHERE eve_PendingAlertEmail = 1 AND eve_EventType != 'Device Down' AND eve_MAC IN
@@ -1425,23 +1423,11 @@ def email_reporting ():
mail_text = mail_text.replace ('<REPORT_DATE>', timeFormated) mail_text = mail_text.replace ('<REPORT_DATE>', timeFormated)
mail_html = mail_html.replace ('<REPORT_DATE>', timeFormated) mail_html = mail_html.replace ('<REPORT_DATE>', timeFormated)
# mail_text = mail_text.replace ('<SCAN_CYCLE>', cycle )
# mail_html = mail_html.replace ('<SCAN_CYCLE>', cycle )
mail_text = mail_text.replace ('<SERVER_NAME>', socket.gethostname() ) mail_text = mail_text.replace ('<SERVER_NAME>', socket.gethostname() )
mail_html = mail_html.replace ('<SERVER_NAME>', socket.gethostname() ) mail_html = mail_html.replace ('<SERVER_NAME>', socket.gethostname() )
# mail_text = mail_text.replace ('<PIALERT_VERSION>', VERSION ) if 'internet' in INCLUDED_SECTIONS:
# mail_html = mail_html.replace ('<PIALERT_VERSION>', VERSION )
# mail_text = mail_text.replace ('<PIALERT_VERSION_DATE>', VERSION_DATE )
# mail_html = mail_html.replace ('<PIALERT_VERSION_DATE>', VERSION_DATE )
# mail_text = mail_text.replace ('<PIALERT_YEAR>', VERSION_YEAR )
# mail_html = mail_html.replace ('<PIALERT_YEAR>', VERSION_YEAR )
# Compose Internet Section # Compose Internet Section
mail_section_Internet = False mail_section_Internet = False
mail_text_Internet = '' mail_text_Internet = ''
mail_html_Internet = '' mail_html_Internet = ''
@@ -1473,7 +1459,7 @@ def email_reporting ():
format_report_section (mail_section_Internet, 'SECTION_INTERNET', format_report_section (mail_section_Internet, 'SECTION_INTERNET',
'TABLE_INTERNET', mail_text_Internet, mail_html_Internet) 'TABLE_INTERNET', mail_text_Internet, mail_html_Internet)
if 'new_devices' in INCLUDED_SECTIONS:
# Compose New Devices Section # Compose New Devices Section
mail_section_new_devices = False mail_section_new_devices = False
mail_text_new_devices = '' mail_text_new_devices = ''
@@ -1505,6 +1491,7 @@ def email_reporting ():
'TABLE_NEW_DEVICES', mail_text_new_devices, mail_html_new_devices) 'TABLE_NEW_DEVICES', mail_text_new_devices, mail_html_new_devices)
if 'down_devices' in INCLUDED_SECTIONS:
# Compose Devices Down Section # Compose Devices Down Section
mail_section_devices_down = False mail_section_devices_down = False
mail_text_devices_down = '' mail_text_devices_down = ''
@@ -1536,6 +1523,7 @@ def email_reporting ():
'TABLE_DEVICES_DOWN', mail_text_devices_down, mail_html_devices_down) 'TABLE_DEVICES_DOWN', mail_text_devices_down, mail_html_devices_down)
if 'events' in INCLUDED_SECTIONS:
# Compose Events Section # Compose Events Section
mail_section_events = False mail_section_events = False
mail_text_events = '' mail_text_events = ''
@@ -1570,7 +1558,6 @@ def email_reporting ():
format_report_section (mail_section_events, 'SECTION_EVENTS', format_report_section (mail_section_events, 'SECTION_EVENTS',
'TABLE_EVENTS', mail_text_events, mail_html_events) 'TABLE_EVENTS', mail_text_events, mail_html_events)
json_final = { json_final = {
"internet": json_internet, "internet": json_internet,
"new_devices": json_new_devices, "new_devices": json_new_devices,