Skip to content

Commit

Permalink
Merge pull request #468 from ScottRoach/main
Browse files Browse the repository at this point in the history
Include device vendor in event notifications by @ScottRoach 🙏
  • Loading branch information
jokob-sk authored Oct 5, 2023
2 parents 2b057d3 + 9072c37 commit 9dfc574
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 4 additions & 0 deletions back/report_sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<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' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</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>
Expand All @@ -54,6 +55,7 @@
<td>New Device</td>
<td>(name not found)</td>
<td></td>
<td></td>
</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>
Expand All @@ -62,6 +64,7 @@
<td>New Device</td>
<td>(name not found)</td>
<td></td>
<td></td>
</tr>
</table>
</td>
Expand All @@ -83,6 +86,7 @@
<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' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</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>
Expand Down
9 changes: 6 additions & 3 deletions back/webhook_json_sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"IP": "192.168.1.1",
"Event Type": "New Device",
"Device name": "(name not found)",
"Comments": null
"Comments": null,
"Device Vendor": null
}],
"down_devices": [],
"events": [{
Expand All @@ -33,14 +34,16 @@
"IP": "192.168.1.92",
"Event Type": "Disconnected",
"Device name": "(name not found)",
"Comments": null
"Comments": null,
"Device Vendor": null
}, {
"MAC": "74:ac:74:ac:74:ac",
"Datetime": "2023-01-30 22:15:09",
"IP": "192.168.1.150",
"Event Type": "Disconnected",
"Device name": "(name not found)",
"Comments": null
"Comments": null,
"Device Vendor": null
}],
"ports": [{
"new": {
Expand Down
9 changes: 6 additions & 3 deletions pialert/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def send_notifications (db):

if 'new_devices' in conf.INCLUDED_SECTIONS :
# 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
AND eve_EventType = 'New Device'
ORDER BY eve_DateTime"""
Expand All @@ -200,7 +201,8 @@ def send_notifications (db):

if 'down_devices' in conf.INCLUDED_SECTIONS :
# 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
AND eve_EventType = 'Device Down'
ORDER BY eve_DateTime"""
Expand All @@ -216,7 +218,8 @@ def send_notifications (db):

if 'events' in conf.INCLUDED_SECTIONS :
# 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
AND eve_EventType IN ('Connected','Disconnected',
'IP Changed')
Expand Down

0 comments on commit 9dfc574

Please sign in to comment.