diff --git a/front/plugins/nslookup_scan/config.json b/front/plugins/nslookup_scan/config.json index c49a41cc..ba0fad8c 100755 --- a/front/plugins/nslookup_scan/config.json +++ b/front/plugins/nslookup_scan/config.json @@ -37,8 +37,8 @@ "function": "RUN", "events": ["run"], "type": "text.select", - "default_value":"on_new_device", - "options": ["disabled", "on_new_device", "once", "schedule", "always_after_scan"], + "default_value":"before_name_updates", + "options": ["disabled", "before_name_updates", "on_new_device", "once", "schedule", "always_after_scan"], "localized": ["name", "description"], "name" :[{ "language_code":"en_us", diff --git a/pialert/__main__.py b/pialert/__main__.py index 33b971ce..48188873 100755 --- a/pialert/__main__.py +++ b/pialert/__main__.py @@ -32,6 +32,7 @@ from database import DB from reporting import get_notifications from notification import Notification_obj from plugin import run_plugin_scripts, check_and_run_user_event +from device import update_devices_names #=============================================================================== @@ -135,8 +136,15 @@ def main (): pluginsState.processScan = False process_scan(db) - + # -------- # Reporting + # run plugins before notification processing (e.g. Plugins to discover device names) + pluginsState = run_plugin_scripts(db, 'before_name_updates', pluginsState) + + # Resolve devices names + mylog('debug','[Main] Resolve devices names') + update_devices_names(db) + # Check if new devices found sql.execute (sql_new_devices) newDevices = sql.fetchall() diff --git a/pialert/networkscan.py b/pialert/networkscan.py index 1d336d3b..1c012ae8 100755 --- a/pialert/networkscan.py +++ b/pialert/networkscan.py @@ -3,7 +3,7 @@ import conf from database import insertOnlineHistory -from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan, update_devices_names +from device import create_new_devices, print_scan_stats, save_scanned_devices, update_devices_data_from_scan from helper import timeNowTZ from logger import mylog from reporting import skip_repeated_notifications @@ -40,10 +40,6 @@ def process_scan (db): mylog('verbose','[Process Scan] Updating Devices Info') update_devices_data_from_scan (db) - # Resolve devices names - mylog('verbose','[Process Scan] Resolve devices names') - update_devices_names(db) - # Void false connection - disconnections mylog('verbose','[Process Scan] Voiding false (ghost) disconnections') void_ghost_disconnections (db)