diff --git a/front/css/pialert.css b/front/css/pialert.css index ec8f4003..4e9cd440 100755 --- a/front/css/pialert.css +++ b/front/css/pialert.css @@ -829,7 +829,7 @@ input[readonly] { { opacity: 0.3; display: initial; - float: inline-start; + float: left; } #networkTree diff --git a/front/plugins/website_monitor/config.json b/front/plugins/website_monitor/config.json index ba3dcc27..8ea65cb1 100755 --- a/front/plugins/website_monitor/config.json +++ b/front/plugins/website_monitor/config.json @@ -2,7 +2,7 @@ "code_name": "website_monitor", "unique_prefix": "WEBMON", "enabled": true, - "data_source": "python-script", + "data_source": "script", "show_ui": true, "localized": ["display_name", "description", "icon"], "display_name" : [{ diff --git a/pialert/initialise.py b/pialert/initialise.py index bee48272..7820faf4 100755 --- a/pialert/initialise.py +++ b/pialert/initialise.py @@ -85,7 +85,7 @@ def importConfigs (db): # 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.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_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') diff --git a/pialert/plugin.py b/pialert/plugin.py index 10487b0b..f1f82ac7 100755 --- a/pialert/plugin.py +++ b/pialert/plugin.py @@ -12,7 +12,7 @@ from const import pluginsPath, logPath from logger import mylog from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value 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 -#------------------------------------------------------------------------------- -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 def process_plugin_events(db, plugin, pluginsState, plugEventsArr): diff --git a/pialert/plugin_utils.py b/pialert/plugin_utils.py index 534e1b98..5ebc67fa 100644 --- a/pialert/plugin_utils.py +++ b/pialert/plugin_utils.py @@ -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 pluginsList.append(json.loads(get_file_content(config_path))) - return pluginsList # Return the list of plugin configurations \ No newline at end of file + 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 \ No newline at end of file