mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Plugins 0.3 - UI fixes 0.1
This commit is contained in:
@@ -1013,8 +1013,7 @@ def scan_network ():
|
||||
updateState("Scan: Network")
|
||||
mylog('verbose', ['[', startTime, '] Scan Devices:' ])
|
||||
|
||||
# # Query ScanCycle properties
|
||||
print_log ('Query ScanCycle confinguration')
|
||||
# Query ScanCycle properties
|
||||
scanCycle_data = query_ScanCycle_Data (True)
|
||||
if scanCycle_data is None:
|
||||
mylog('none', ['\n*************** ERROR ***************'])
|
||||
@@ -3790,12 +3789,12 @@ def execute_plugin(plugin):
|
||||
# prepare command from plugin settings, custom parameters
|
||||
command = resolve_wildcards(set_CMD, params).split()
|
||||
|
||||
# Execute command
|
||||
mylog('verbose', [' [Plugins] Executing: ', set_CMD])
|
||||
|
||||
# python-script
|
||||
if plugin['data_source'] == 'python-script':
|
||||
|
||||
# Execute command
|
||||
mylog('verbose', [' [Plugins] Executing: ', set_CMD])
|
||||
|
||||
try:
|
||||
# try runnning a subprocess with a forced timeout in case the subprocess hangs
|
||||
output = subprocess.check_output (command, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(set_RUN_TIMEOUT))
|
||||
@@ -3815,8 +3814,6 @@ def execute_plugin(plugin):
|
||||
# cleanup - select only lines containing a separator to filter out unnecessary data
|
||||
newLines = list(filter(lambda x: '|' in x, newLines))
|
||||
|
||||
pluginEventCount = len(newLines)
|
||||
|
||||
# # regular logging
|
||||
# for line in newLines:
|
||||
# append_line_to_file (pluginsPath + '/plugin.log', line +'\n')
|
||||
@@ -3834,11 +3831,17 @@ def execute_plugin(plugin):
|
||||
|
||||
# pialert-db-query
|
||||
if plugin['data_source'] == 'pialert-db-query':
|
||||
# replace single quotes wildcards
|
||||
q = set_CMD.replace("{s-quote}", '\'')
|
||||
|
||||
# Execute command
|
||||
mylog('verbose', [' [Plugins] Executing: ', q])
|
||||
|
||||
# build SQL query parameters to insert into the DB
|
||||
sqlParams = []
|
||||
|
||||
# set_CMD should contain a SQL query
|
||||
arr = get_sql_array (set_CMD.replace("{s-quote}", '\''))
|
||||
arr = get_sql_array (q)
|
||||
|
||||
for row in arr:
|
||||
# There has to be always 8 columns
|
||||
@@ -3853,7 +3856,7 @@ def execute_plugin(plugin):
|
||||
mylog('none', [' [Plugins] No output received from the plugin ', plugin["unique_prefix"], ' - enable LOG_LEVEL=debug and check logs'])
|
||||
return
|
||||
else:
|
||||
mylog('verbose', ['[', timeNow(), '] [Plugins]: SUCCESS, received ', pluginEventCount, ' entries'])
|
||||
mylog('verbose', ['[', timeNow(), '] [Plugins]: SUCCESS, received ', len(sqlParams), ' entries'])
|
||||
|
||||
# process results if any
|
||||
if len(sqlParams) > 0:
|
||||
|
||||
@@ -211,8 +211,6 @@ function generateTabs()
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Generate the event rows
|
||||
for(i=0;i<pluginUnprocessedEvents.length;i++)
|
||||
{
|
||||
@@ -243,16 +241,17 @@ function generateTabs()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Generate the object rows
|
||||
for(i=0;i<pluginObjects.length;i++)
|
||||
for(var i=0;i<pluginObjects.length;i++)
|
||||
{
|
||||
if(pluginObjects[i].Plugin == obj.unique_prefix)
|
||||
{
|
||||
clm = ""
|
||||
|
||||
for(j=0;j<colDefinitions.length;j++)
|
||||
for(var j=0;j<colDefinitions.length;j++)
|
||||
{
|
||||
|
||||
clm += '<td>'+ getFormControl(colDefinitions[j], pluginObjects[i][colDefinitions[j].column], pluginObjects[i]["Index"]) +'</td>'
|
||||
}
|
||||
obRows += '<tr>' + clm + '</tr>'
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
}]
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryD",
|
||||
"column": "Object_SecondaryID",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
|
||||
Reference in New Issue
Block a user