mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-09-13 06:36:58 -04:00
DOCS: skills + SQL cleanup
This commit is contained in:
1 parent
a976fe0923
commit
cc3ccbcaf0
12 files changed
+195
-2
No files matched your search
@@ -575,6 +575,14 @@ def ensure_CurrentScan(sql) -> bool:
|
||||
scanType STRING(250)
|
||||
);
|
||||
""")
|
||||
# scanMac has no uniqueness constraint - multiple plugins commonly report
|
||||
# the same MAC in one cycle (e.g. arp_scan + nslookup), so every lookup
|
||||
# keyed on scanMac (update_presence_from_CurrentScan, insert_events, the
|
||||
# LatestDeviceScan/LatestEventsPerMAC views) was a full table scan without
|
||||
# this. Table is dropped every cycle, so the index is rebuilt with it -
|
||||
# cheap insurance against O(n^2) scans at NOC-scale device counts (10k+ in
|
||||
# real deployments).
|
||||
sql.execute("CREATE INDEX IF NOT EXISTS idx_currentscan_scanmac ON CurrentScan(scanMac);")
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -164,9 +164,10 @@ CREATE TABLE CurrentScan (
|
||||
scanVlan STRING(250),
|
||||
scanParentMAC STRING(250),
|
||||
scanParentPort STRING(250),
|
||||
scanType STRING(250),
|
||||
UNIQUE(scanMac)
|
||||
scanFQDN STRING(250),
|
||||
scanType STRING(250)
|
||||
);
|
||||
CREATE INDEX idx_currentscan_scanmac ON CurrentScan(scanMac);
|
||||
CREATE TABLE IF NOT EXISTS AppEvents (
|
||||
"index" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
guid TEXT UNIQUE,
|
||||
|
||||
Reference in new issue
Block a user