update_vendors work #533 🔃

This commit is contained in:
Jokob-sk
2024-01-13 08:42:31 +11:00
parent b5afdb2bce
commit 7561a8478d
6 changed files with 13 additions and 12 deletions

View File

@@ -18,7 +18,7 @@ The original pilaert.py code is now moved to this new folder and split into diff
|```helper.py```| Helper as the name suggest contains multiple little functions and methods used in many of the other modules and helps keep things clean |
|```initialise.py```| Initiatlise sets up the environment and makes everything ready to go |
|```logger.py```| Logger is there the keep all the logs organised and looking identical. |
|```networscan.py```| Networkscan collects teh scan results (maybe to merge with `reporting.py`) |
|```networscan.py```| Networkscan collects the scan results (maybe to merge with `reporting.py`) |
|```notification.py```| Creates and handles the notification object and generates ther HTML and text variants of the message |
|```plugin.py```| This is where the plugins get integrated into the backend of Pi.Alert |
|```plugin_utils.py```| Helper utilities for `plugin.py` |

View File

@@ -366,9 +366,12 @@ def query_MAC_vendor (pMAC):
with open(vendorsPath, 'r') as f:
for line in f:
if line.startswith(mac_start_string6):
vendor = line.split(' ', 1)[1].strip()
mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}' in {vendorsPath}"])
return vendor
mylog('debug', [f"[Vendor Check] Macth found, line to process: {line}"])
parts = line.split(' ', 1)
if len(parts) > 1:
vendor = parts[1].strip()
mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}' in {vendorsPath}"])
return vendor
return -1 # MAC address not found in the database

View File

@@ -84,8 +84,8 @@ def get_notifications (db):
# Compose Devices Down Section
# - select only Down Alerts with pending email of devices that didn't reconnect within the specified time window
sqlQuery = f"""
SELECT *
FROM Events AS down_events
SELECT dev_Name, eve_MAC, dev_Vendor, eve_IP, eve_DateTime, eve_EventType
FROM Events_Devices AS down_events
WHERE eve_PendingAlertEmail = 1
AND down_events.eve_EventType = 'Device Down'
AND eve_DateTime < datetime('now', '-{get_setting_value('NTFPRCS_alert_down_time')} minutes', '{get_timezone_offset()}')