update only unknown vendors
This commit is contained in:
@@ -41,6 +41,7 @@ from cron_converter import Cron
|
|||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
from json2table import convert
|
from json2table import convert
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# SQL queries
|
# SQL queries
|
||||||
@@ -126,10 +127,11 @@ def file_print (*args):
|
|||||||
|
|
||||||
result = ''
|
result = ''
|
||||||
|
|
||||||
file = open(logPath + "/pialert.log", "a")
|
|
||||||
for arg in args:
|
for arg in args:
|
||||||
result += str(arg)
|
result += str(arg)
|
||||||
print(result)
|
print(result)
|
||||||
|
|
||||||
|
file = open(logPath + "/pialert.log", "a")
|
||||||
file.write(result + '\n')
|
file.write(result + '\n')
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
@@ -655,7 +657,31 @@ def main ():
|
|||||||
if last_network_scan + datetime.timedelta(minutes=SCAN_CYCLE_MINUTES) < time_started:
|
if last_network_scan + datetime.timedelta(minutes=SCAN_CYCLE_MINUTES) < time_started:
|
||||||
last_network_scan = time_started
|
last_network_scan = time_started
|
||||||
cycle = 1 # network scan
|
cycle = 1 # network scan
|
||||||
scan_network()
|
# scan_network()
|
||||||
|
|
||||||
|
# DEBUG start ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
# Start scan_network as a process
|
||||||
|
|
||||||
|
p = multiprocessing.Process(target=scan_network)
|
||||||
|
p.start()
|
||||||
|
|
||||||
|
# Wait for 3600 seconds (max 1h) or until process finishes
|
||||||
|
p.join(3600)
|
||||||
|
|
||||||
|
# If thread is still active
|
||||||
|
if p.is_alive():
|
||||||
|
print "DEBUG scan_network running too long - let's kill it"
|
||||||
|
mylog('info', [' DEBUG scan_network running too long - let\'s kill it'])
|
||||||
|
|
||||||
|
# Terminate - may not work if process is stuck for good
|
||||||
|
p.terminate()
|
||||||
|
# OR Kill - will work for sure, no chance for process to finish nicely however
|
||||||
|
# p.kill()
|
||||||
|
|
||||||
|
p.join()
|
||||||
|
|
||||||
|
# DEBUG end ++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
|
||||||
# Reporting
|
# Reporting
|
||||||
if cycle in check_report:
|
if cycle in check_report:
|
||||||
@@ -951,7 +977,10 @@ def update_devices_MAC_vendors (pArg = ''):
|
|||||||
|
|
||||||
# All devices loop
|
# All devices loop
|
||||||
mylog('verbose', [' Searching devices vendor'])
|
mylog('verbose', [' Searching devices vendor'])
|
||||||
for device in sql.execute ("SELECT * FROM Devices") :
|
for device in sql.execute ("""SELECT * FROM Devices
|
||||||
|
WHERE dev_Vendor = '(unknown)'
|
||||||
|
OR dev_Vendor =''
|
||||||
|
OR dev_Vendor IS NULL""") :
|
||||||
# Search vendor in HW Vendors DB
|
# Search vendor in HW Vendors DB
|
||||||
vendor = query_MAC_vendor (device['dev_MAC'])
|
vendor = query_MAC_vendor (device['dev_MAC'])
|
||||||
if vendor == -1 :
|
if vendor == -1 :
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ You can assign icons individually on each device in the Details tab.
|
|||||||
1. For any value that is only prefixed with `fa-`, you can enter the value directly, such as `server`, `tv`, `ethernet`.
|
1. For any value that is only prefixed with `fa-`, you can enter the value directly, such as `server`, `tv`, `ethernet`.
|
||||||
2. If you want to add another classname, e.g. `fa-brands`, you can enter `brands fa-[fontawesome-icon-name]`, so for `apple` that is using the syntax`fa-brands fa-apple`, you would enter `brands fa-apple`.
|
2. If you want to add another classname, e.g. `fa-brands`, you can enter `brands fa-[fontawesome-icon-name]`, so for `apple` that is using the syntax`fa-brands fa-apple`, you would enter `brands fa-apple`.
|
||||||
|
|
||||||
- If you want to mass-apply an icon to all devices of the same device type (Field marked (4) in the above screenshot), you can click the copy button (Marked (1) in the above screenshot). A confirmation prompt is dispalyed. If you proceed, icons of all devices set to the same device type as the current device, will be overwritten with the current devices icon.
|
- If you want to mass-apply an icon to all devices of the same device type (Field marked (4) in the above screenshot), you can click the copy button (Marked (1) in the above screenshot). A confirmation prompt is displayed. If you proceed, icons of all devices set to the same device type as the current device, will be overwritten with the current device's icon.
|
||||||
|
|
||||||
- The dropdown (3) contains all icons already used in the app for device icons. You need to navigate away or refresh the page once you add a new icon.
|
- The dropdown (3) contains all icons already used in the app for device icons. You need to navigate away or refresh the page once you add a new icon.
|
||||||
|
|||||||
Reference in New Issue
Block a user