Merge pull request #468 from ScottRoach/main

Include device vendor in event notifications by @ScottRoach 🙏
This commit is contained in:
jokob-sk
2023-10-05 05:17:31 +00:00
committed by GitHub
3 changed files with 16 additions and 6 deletions

View File

@@ -46,6 +46,7 @@
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</tr> </tr>
<tr> <tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td> <td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
@@ -54,6 +55,7 @@
<td>New Device</td> <td>New Device</td>
<td>(name not found)</td> <td>(name not found)</td>
<td></td> <td></td>
<td></td>
</tr> </tr>
<tr> <tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td> <td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
@@ -62,6 +64,7 @@
<td>New Device</td> <td>New Device</td>
<td>(name not found)</td> <td>(name not found)</td>
<td></td> <td></td>
<td></td>
</tr> </tr>
</table> </table>
</td> </td>
@@ -83,6 +86,7 @@
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th> <th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</tr> </tr>
<tr> <tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td> <td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>

View File

@@ -24,7 +24,8 @@
"IP": "192.168.1.1", "IP": "192.168.1.1",
"Event Type": "New Device", "Event Type": "New Device",
"Device name": "(name not found)", "Device name": "(name not found)",
"Comments": null "Comments": null,
"Device Vendor": null
}], }],
"down_devices": [], "down_devices": [],
"events": [{ "events": [{
@@ -33,14 +34,16 @@
"IP": "192.168.1.92", "IP": "192.168.1.92",
"Event Type": "Disconnected", "Event Type": "Disconnected",
"Device name": "(name not found)", "Device name": "(name not found)",
"Comments": null "Comments": null,
"Device Vendor": null
}, { }, {
"MAC": "74:ac:74:ac:74:ac", "MAC": "74:ac:74:ac:74:ac",
"Datetime": "2023-01-30 22:15:09", "Datetime": "2023-01-30 22:15:09",
"IP": "192.168.1.150", "IP": "192.168.1.150",
"Event Type": "Disconnected", "Event Type": "Disconnected",
"Device name": "(name not found)", "Device name": "(name not found)",
"Comments": null "Comments": null,
"Device Vendor": null
}], }],
"ports": [{ "ports": [{
"new": { "new": {

View File

@@ -184,7 +184,8 @@ def send_notifications (db):
if 'new_devices' in conf.INCLUDED_SECTIONS : if 'new_devices' in conf.INCLUDED_SECTIONS :
# Compose New Devices Section # Compose New Devices Section
sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments, dev_Vendor as "Device Vendor"
FROM Events_Devices
WHERE eve_PendingAlertEmail = 1 WHERE eve_PendingAlertEmail = 1
AND eve_EventType = 'New Device' AND eve_EventType = 'New Device'
ORDER BY eve_DateTime""" ORDER BY eve_DateTime"""
@@ -200,7 +201,8 @@ def send_notifications (db):
if 'down_devices' in conf.INCLUDED_SECTIONS : if 'down_devices' in conf.INCLUDED_SECTIONS :
# Compose Devices Down Section # Compose Devices Down Section
sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments, dev_Vendor as "Device Vendor"
FROM Events_Devices
WHERE eve_PendingAlertEmail = 1 WHERE eve_PendingAlertEmail = 1
AND eve_EventType = 'Device Down' AND eve_EventType = 'Device Down'
ORDER BY eve_DateTime""" ORDER BY eve_DateTime"""
@@ -216,7 +218,8 @@ def send_notifications (db):
if 'events' in conf.INCLUDED_SECTIONS : if 'events' in conf.INCLUDED_SECTIONS :
# Compose Events Section # Compose Events Section
sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices sqlQuery = """SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments, dev_Vendor as "Device Vendor"
FROM Events_Devices
WHERE eve_PendingAlertEmail = 1 WHERE eve_PendingAlertEmail = 1
AND eve_EventType IN ('Connected','Disconnected', AND eve_EventType IN ('Connected','Disconnected',
'IP Changed') 'IP Changed')