From 47a3f7073bcf33ff1ef18281c1db1202578ddd1e Mon Sep 17 00:00:00 2001 From: Jokob-sk Date: Mon, 18 Dec 2023 07:55:41 +1100 Subject: [PATCH] _meta unbound #519 --- front/plugins/notification_processing/config.json | 2 +- pialert/notification.py | 5 +++++ pialert/reporting.py | 7 +++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/front/plugins/notification_processing/config.json b/front/plugins/notification_processing/config.json index 42a47638..cdd32c6d 100755 --- a/front/plugins/notification_processing/config.json +++ b/front/plugins/notification_processing/config.json @@ -125,7 +125,7 @@ { "function": "alert_down_time", "type": "integer", - "default_value": 8, + "default_value": 5, "options": [], "localized": ["name", "description"], "name": [ diff --git a/pialert/notification.py b/pialert/notification.py index e3c52577..e9264df3 100755 --- a/pialert/notification.py +++ b/pialert/notification.py @@ -250,6 +250,11 @@ class Notification_obj: def construct_notifications(JSON, section): jsn = JSON[section] + + # Return if empty + if jsn == []: + return '','' + tableTitle = JSON[section + "_meta"]["title"] headers = JSON[section + "_meta"]["columnNames"] diff --git a/pialert/reporting.py b/pialert/reporting.py index db6de040..d4d0f15b 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -36,10 +36,13 @@ def get_notifications (db): # prepare variables for JSON construction json_new_devices = [] + json_new_devices_meta = {} json_down_devices = [] - json_events = [] - json_ports = [] + json_down_devices_meta = {} + json_events = [] + json_events_meta = {} json_plugins = [] + json_plugins_meta = {} # Disable reporting on events for devices where reporting is disabled based on the MAC address sql.execute ("""UPDATE Events SET eve_PendingAlertEmail = 0