mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
webmon fixes + breakup plugins.py
This commit is contained in:
@@ -829,7 +829,7 @@ input[readonly] {
|
|||||||
{
|
{
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
display: initial;
|
display: initial;
|
||||||
float: inline-start;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
#networkTree
|
#networkTree
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"code_name": "website_monitor",
|
"code_name": "website_monitor",
|
||||||
"unique_prefix": "WEBMON",
|
"unique_prefix": "WEBMON",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"data_source": "python-script",
|
"data_source": "script",
|
||||||
"show_ui": true,
|
"show_ui": true,
|
||||||
"localized": ["display_name", "description", "icon"],
|
"localized": ["display_name", "description", "icon"],
|
||||||
"display_name" : [{
|
"display_name" : [{
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ def importConfigs (db):
|
|||||||
# General
|
# General
|
||||||
conf.LOG_LEVEL = ccd('LOG_LEVEL', 'verbose' , c_d, 'Log verboseness', 'text.select', "['none', 'minimal', 'verbose', 'debug']", 'General')
|
conf.LOG_LEVEL = ccd('LOG_LEVEL', 'verbose' , c_d, 'Log verboseness', 'text.select', "['none', 'minimal', 'verbose', 'debug']", 'General')
|
||||||
conf.TIMEZONE = ccd('TIMEZONE', 'Europe/Berlin' , c_d, 'Time zone', 'text', '', 'General')
|
conf.TIMEZONE = ccd('TIMEZONE', 'Europe/Berlin' , c_d, 'Time zone', 'text', '', 'General')
|
||||||
conf.PLUGINS_KEEP_HIST = ccd('PLUGINS_KEEP_HIST', 10000 , c_d, 'Keep history entries', 'integer', '', 'General')
|
conf.PLUGINS_KEEP_HIST = ccd('PLUGINS_KEEP_HIST', 1000 , c_d, 'Keep history entries', 'integer', '', 'General')
|
||||||
conf.PIALERT_WEB_PROTECTION = ccd('PIALERT_WEB_PROTECTION', False , c_d, 'Enable logon', 'boolean', '', 'General')
|
conf.PIALERT_WEB_PROTECTION = ccd('PIALERT_WEB_PROTECTION', False , c_d, 'Enable logon', 'boolean', '', 'General')
|
||||||
conf.PIALERT_WEB_PASSWORD = ccd('PIALERT_WEB_PASSWORD', '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92' , c_d, 'Logon password', 'readonly', '', 'General')
|
conf.PIALERT_WEB_PASSWORD = ccd('PIALERT_WEB_PASSWORD', '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92' , c_d, 'Logon password', 'readonly', '', 'General')
|
||||||
conf.INCLUDED_SECTIONS = ccd('INCLUDED_SECTIONS', ['internet', 'new_devices', 'down_devices', 'events', 'ports'] , c_d, 'Notify on', 'text.multiselect', "['internet', 'new_devices', 'down_devices', 'events', 'ports', 'plugins']", 'General')
|
conf.INCLUDED_SECTIONS = ccd('INCLUDED_SECTIONS', ['internet', 'new_devices', 'down_devices', 'events', 'ports'] , c_d, 'Notify on', 'text.multiselect', "['internet', 'new_devices', 'down_devices', 'events', 'ports', 'plugins']", 'General')
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ from const import pluginsPath, logPath
|
|||||||
from logger import mylog
|
from logger import mylog
|
||||||
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
||||||
from api import update_api
|
from api import update_api
|
||||||
from plugin_utils import logEventStatusCounts, get_plugin_string, get_plugin_setting, print_plugin_info, flatten_array, combine_plugin_objects, resolve_wildcards_arr
|
from plugin_utils import logEventStatusCounts, get_plugin_string, get_plugin_setting, print_plugin_info, flatten_array, combine_plugin_objects, resolve_wildcards_arr, get_plugin_setting_value, handle_empty, custom_plugin_decoder
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@@ -296,17 +296,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
|
|||||||
|
|
||||||
return pluginsState
|
return pluginsState
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
def custom_plugin_decoder(pluginDict):
|
|
||||||
return namedtuple('X', pluginDict.keys())(*pluginDict.values())
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Handle empty value
|
|
||||||
def handle_empty(value):
|
|
||||||
if value == '' or value is None:
|
|
||||||
value = 'null'
|
|
||||||
|
|
||||||
return value
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
@@ -341,26 +331,6 @@ def passable_string_from_setting(globalSetting):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
|
||||||
# Gets the setting value
|
|
||||||
def get_plugin_setting_value(plugin, function_key):
|
|
||||||
|
|
||||||
resultObj = get_plugin_setting(plugin, function_key)
|
|
||||||
|
|
||||||
if resultObj != None:
|
|
||||||
return resultObj["value"]
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Check if watched values changed for the given plugin
|
# Check if watched values changed for the given plugin
|
||||||
def process_plugin_events(db, plugin, pluginsState, plugEventsArr):
|
def process_plugin_events(db, plugin, pluginsState, plugEventsArr):
|
||||||
|
|||||||
@@ -160,4 +160,29 @@ def get_plugins_configs():
|
|||||||
# Load the contents of the config.json file as a JSON object and append it to pluginsList
|
# Load the contents of the config.json file as a JSON object and append it to pluginsList
|
||||||
pluginsList.append(json.loads(get_file_content(config_path)))
|
pluginsList.append(json.loads(get_file_content(config_path)))
|
||||||
|
|
||||||
return pluginsList # Return the list of plugin configurations
|
return pluginsList # Return the list of plugin configurations
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Gets the setting value
|
||||||
|
def get_plugin_setting_value(plugin, function_key):
|
||||||
|
|
||||||
|
resultObj = get_plugin_setting(plugin, function_key)
|
||||||
|
|
||||||
|
if resultObj != None:
|
||||||
|
return resultObj["value"]
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
def custom_plugin_decoder(pluginDict):
|
||||||
|
return namedtuple('X', pluginDict.keys())(*pluginDict.values())
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# Handle empty value
|
||||||
|
def handle_empty(value):
|
||||||
|
if value == '' or value is None:
|
||||||
|
value = 'null'
|
||||||
|
|
||||||
|
return value
|
||||||
Reference in New Issue
Block a user