mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
LOG_LEVEL fix, WEBMON timeout multiplier, docs, fix for watched-changed #1053
This commit is contained in:
@@ -33,7 +33,7 @@ from initialise import importConfigs
|
||||
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 plugin import plugin_manager
|
||||
from scan.device_handling import update_devices_names
|
||||
from workflows.manager import WorkflowManager
|
||||
|
||||
@@ -96,6 +96,9 @@ def main ():
|
||||
# re-load user configuration and plugins
|
||||
all_plugins, imported = importConfigs(db, all_plugins)
|
||||
|
||||
# initiate plugin manager
|
||||
pm = plugin_manager(db, all_plugins)
|
||||
|
||||
# update time started
|
||||
conf.loop_start_time = timeNowTZ()
|
||||
|
||||
@@ -103,11 +106,11 @@ def main ():
|
||||
|
||||
# Handle plugins executed ONCE
|
||||
if conf.plugins_once_run == False:
|
||||
run_plugin_scripts(db, all_plugins, 'once')
|
||||
pm.run_plugin_scripts('once')
|
||||
conf.plugins_once_run = True
|
||||
|
||||
# check if user is waiting for api_update
|
||||
check_and_run_user_event(db, all_plugins)
|
||||
pm.check_and_run_user_event()
|
||||
|
||||
# Update API endpoints
|
||||
update_api(db, all_plugins, False)
|
||||
@@ -126,13 +129,13 @@ def main ():
|
||||
startTime = startTime.replace (microsecond=0)
|
||||
|
||||
# Check if any plugins need to run on schedule
|
||||
run_plugin_scripts(db, all_plugins, 'schedule')
|
||||
pm.run_plugin_scripts('schedule')
|
||||
|
||||
# determine run/scan type based on passed time
|
||||
# --------------------------------------------
|
||||
|
||||
# Runs plugin scripts which are set to run every time after a scans finished
|
||||
run_plugin_scripts(db, all_plugins, 'always_after_scan')
|
||||
pm.run_plugin_scripts('always_after_scan')
|
||||
|
||||
# process all the scanned data into new devices
|
||||
processScan = updateState("Check scan").processScan
|
||||
@@ -146,7 +149,7 @@ def main ():
|
||||
# --------
|
||||
# Reporting
|
||||
# run plugins before notification processing (e.g. Plugins to discover device names)
|
||||
run_plugin_scripts(db, all_plugins, 'before_name_updates')
|
||||
pm.run_plugin_scripts('before_name_updates')
|
||||
|
||||
# Resolve devices names
|
||||
mylog('debug','[Main] Resolve devices names')
|
||||
@@ -160,7 +163,7 @@ def main ():
|
||||
# new devices were found
|
||||
if len(newDevices) > 0:
|
||||
# run all plugins registered to be run when new devices are found
|
||||
run_plugin_scripts(db, all_plugins, 'on_new_device')
|
||||
pm.run_plugin_scripts('on_new_device')
|
||||
|
||||
# Notification handling
|
||||
# ----------------------------------------
|
||||
@@ -175,7 +178,7 @@ def main ():
|
||||
# run all enabled publisher gateways
|
||||
if notificationObj.HasNotifications:
|
||||
|
||||
run_plugin_scripts(db, all_plugins, 'on_notification')
|
||||
pm.run_plugin_scripts('on_notification')
|
||||
notification.setAllProcessed()
|
||||
notification.clearPendingEmailFlag()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user