mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
work #504 - New Dev + Events filter setting⚙
This commit is contained in:
@@ -46,7 +46,7 @@ class Notification_obj:
|
||||
# Create a new DB entry if new notifications available, otherwise skip
|
||||
def create(self, JSON, Extra=""):
|
||||
|
||||
JSON, Extra = self.on_before_create(self, JSON, Extra)
|
||||
JSON, Extra = self.on_before_create(JSON, Extra)
|
||||
|
||||
# Write output data for debug
|
||||
write_file (logPath + '/report_output.json', json.dumps(JSON))
|
||||
|
||||
@@ -61,9 +61,10 @@ def get_notifications (db):
|
||||
|
||||
if 'new_devices' in conf.INCLUDED_SECTIONS:
|
||||
# Compose New Devices Section
|
||||
sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
WHERE eve_PendingAlertEmail = 1
|
||||
AND eve_EventType = 'New Device'
|
||||
{get_setting_value('NTFPRCS_new_dev_condition')}
|
||||
ORDER BY eve_DateTime"""
|
||||
|
||||
# Get the events as JSON
|
||||
@@ -73,6 +74,7 @@ def get_notifications (db):
|
||||
"title": "New devices",
|
||||
"columnNames": json_obj.columnNames
|
||||
}
|
||||
|
||||
json_new_devices = json_obj.json["data"]
|
||||
|
||||
if 'down_devices' in conf.INCLUDED_SECTIONS:
|
||||
@@ -105,10 +107,11 @@ def get_notifications (db):
|
||||
|
||||
if 'events' in conf.INCLUDED_SECTIONS:
|
||||
# Compose Events Section
|
||||
sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices
|
||||
WHERE eve_PendingAlertEmail = 1
|
||||
AND eve_EventType IN ('Connected','Disconnected',
|
||||
'IP Changed')
|
||||
{get_setting_value('NTFPRCS_event_condition')}
|
||||
ORDER BY eve_DateTime"""
|
||||
|
||||
# Get the events as JSON
|
||||
|
||||
Reference in New Issue
Block a user