mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 01:26:11 -08:00
implemented apprise notifications + readme updates
This commit is contained in:
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
# list of Docker images to use as base name for tags
|
||||||
images: |
|
images: |
|
||||||
jokobsk/pi.alert
|
jokobsk/pi.alert_dev
|
||||||
# generate Docker tags based on the following events/attributes
|
# generate Docker tags based on the following events/attributes
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -23,13 +23,13 @@ JavaScript)*
|
|||||||
<img alt="Docker last pushed" src="https://img.shields.io/badge/dynamic/json?color=blue&label=Last%20pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&?link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert">
|
<img alt="Docker last pushed" src="https://img.shields.io/badge/dynamic/json?color=blue&label=Last%20pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&?link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
🥇 Pi.Alert credit goes to [pucherot/Pi.Alert](https://github.com/pucherot/Pi.Alert). <br/>
|
🥇 Pi.Alert credit goes to [pucherot/Pi.Alert](https://github.com/pucherot/Pi.Alert) <br/>
|
||||||
🐳 Docker Image: [jokobsk/Pi.Alert](https://registry.hub.docker.com/r/jokobsk/pi.alert). <br/>
|
🐳 Docker Image: [jokobsk/Pi.Alert](https://registry.hub.docker.com/r/jokobsk/pi.alert) <br/>
|
||||||
📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) <br/>
|
📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) <br/>
|
||||||
📚 [Dockerfile instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md).
|
📚 [Dockerfile instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md)
|
||||||
|
|
||||||
|
|
||||||
Dark mode (and Device presence over time) within this fork courtesy of [leiweibau](https://github.com/leiweibau/Pi.Alert)
|
Dark mode (and much more) within this fork courtesy of [leiweibau](https://github.com/leiweibau/Pi.Alert)
|
||||||
|
|
||||||
## How it works
|
## How it works
|
||||||
The system continuously scans the network for:
|
The system continuously scans the network for:
|
||||||
@@ -61,7 +61,7 @@ In charge of:
|
|||||||
- Scan the network searching connected devices using the scanning methods
|
- Scan the network searching connected devices using the scanning methods
|
||||||
described
|
described
|
||||||
- Store the information in the DB
|
- Store the information in the DB
|
||||||
- Report the changes detected by e-mail and/or other services (Pushsafer, NTFY, Gotify, Webhooks ([sample JSON](docs/webhook_json_sample.json)))
|
- Report the changes detected by e-mail and/or other services ([Apprise](https://hub.docker.com/r/caronc/apprise), [Pushsafer](https://www.pushsafer.com/), [NTFY](https://ntfy.sh/), Webhooks ([sample JSON](docs/webhook_json_sample.json)))
|
||||||
- Optional speedtest for Device "Internet"
|
- Optional speedtest for Device "Internet"
|
||||||
- DB cleanup tasks via cron
|
- DB cleanup tasks via cron
|
||||||
- a pialert-cli that helps to configure login and password
|
- a pialert-cli that helps to configure login and password
|
||||||
|
|||||||
@@ -1424,6 +1424,11 @@ def email_reporting ():
|
|||||||
send_email (mail_text, mail_html)
|
send_email (mail_text, mail_html)
|
||||||
else :
|
else :
|
||||||
print (' Skip mail...')
|
print (' Skip mail...')
|
||||||
|
if REPORT_APPRISE :
|
||||||
|
print (' Sending report by Apprise...')
|
||||||
|
send_apprise (mail_html)
|
||||||
|
else :
|
||||||
|
print (' Skip Apprise...')
|
||||||
if REPORT_WEBHOOK :
|
if REPORT_WEBHOOK :
|
||||||
print (' Sending report by webhook...')
|
print (' Sending report by webhook...')
|
||||||
send_webhook (json_final)
|
send_webhook (json_final)
|
||||||
@@ -1602,10 +1607,24 @@ def send_webhook (_json):
|
|||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
# write stdout and stderr into .log files for debugging if needed
|
# write stdout and stderr into .log files for debugging if needed
|
||||||
if stderr != None:
|
logResult (stdout, stderr)
|
||||||
append_file_binary (LOG_PATH + '/stderr.log', stderr)
|
|
||||||
if stdout != None:
|
#-------------------------------------------------------------------------------
|
||||||
append_file_binary (LOG_PATH + '/stdout.log', stdout)
|
def send_apprise (html):
|
||||||
|
#Define Apprise compatible payload (https://github.com/caronc/apprise-api#stateless-solution)
|
||||||
|
_json_payload={
|
||||||
|
"urls": APPRISE_URL,
|
||||||
|
"title": "Pi.Alert Notifications",
|
||||||
|
"format": "html",
|
||||||
|
"body": html
|
||||||
|
}
|
||||||
|
|
||||||
|
p = subprocess.Popen(["curl","-i","-X", "POST" ,"-H", "Content-Type:application/json" ,"-d", json.dumps(_json_payload), APPRISE_HOST], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
|
# write stdout and stderr into .log files for debugging if needed
|
||||||
|
logResult (stdout, stderr)
|
||||||
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
@@ -1744,6 +1763,14 @@ def add_json_list (row, list):
|
|||||||
|
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def logResult (stdout, stderr):
|
||||||
|
if stderr != None:
|
||||||
|
append_file_binary (LOG_PATH + '/stderr.log', stderr)
|
||||||
|
if stdout != None:
|
||||||
|
append_file_binary (LOG_PATH + '/stdout.log', stdout)
|
||||||
|
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# BEGIN
|
# BEGIN
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ REPORT_DASHBOARD_URL = 'http://pi.alert/'
|
|||||||
REPORT_WEBHOOK = False
|
REPORT_WEBHOOK = False
|
||||||
WEBHOOK_URL = 'http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
|
WEBHOOK_URL = 'http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
|
||||||
|
|
||||||
|
# Apprise settings
|
||||||
|
#-----------------------
|
||||||
|
REPORT_APPRISE = False
|
||||||
|
APPRISE_HOST = 'http://localhost:8000/notify'
|
||||||
|
APPRISE_URL = 'mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'
|
||||||
|
|
||||||
# NTFY (https://ntfy.sh/) settings
|
# NTFY (https://ntfy.sh/) settings
|
||||||
# ----------------------
|
# ----------------------
|
||||||
REPORT_NTFY = False
|
REPORT_NTFY = False
|
||||||
@@ -64,6 +70,7 @@ DHCP_ACTIVE = False
|
|||||||
DHCP_LEASES = '/etc/pihole/dhcp.leases'
|
DHCP_LEASES = '/etc/pihole/dhcp.leases'
|
||||||
|
|
||||||
# arp-scan options & samples
|
# arp-scan options & samples
|
||||||
|
# ----------------------
|
||||||
#
|
#
|
||||||
# Scan local network (default)
|
# Scan local network (default)
|
||||||
# SCAN_SUBNETS = '--localnet'
|
# SCAN_SUBNETS = '--localnet'
|
||||||
@@ -79,3 +86,4 @@ SCAN_SUBNETS = '--localnet'
|
|||||||
# Maintenance Tasks Cron
|
# Maintenance Tasks Cron
|
||||||
# ----------------------
|
# ----------------------
|
||||||
DAYS_TO_KEEP_EVENTS = 90
|
DAYS_TO_KEEP_EVENTS = 90
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
# 🐳 A docker image for Pi.Alert
|
# 🐳 A docker image for Pi.Alert
|
||||||
|
|
||||||
🥇 Pi.Alert credit goes to [pucherot/Pi.Alert](https://github.com/pucherot/Pi.Alert). <br/>
|
🥇 Pi.Alert credit goes to [pucherot/Pi.Alert](https://github.com/pucherot/Pi.Alert) <br/>
|
||||||
🐳 Docker Image: [jokobsk/Pi.Alert](https://registry.hub.docker.com/r/jokobsk/pi.alert). <br/>
|
🐳 Docker Image: [jokobsk/Pi.Alert](https://registry.hub.docker.com/r/jokobsk/pi.alert) <br/>
|
||||||
📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) <br/>
|
📄 [Dockerfile](https://github.com/jokob-sk/Pi.Alert/blob/main/Dockerfile) <br/>
|
||||||
📚 [Dockerfile instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md).
|
📚 [Dockerfile instructions](https://github.com/jokob-sk/Pi.Alert/blob/main//dockerfiles/README.md)
|
||||||
|
|
||||||
Big thanks to <a href="https://github.com/Macleykun">@Macleykun</a> for help and tips&tricks for Dockerfile(s):
|
Big thanks to <a href="https://github.com/Macleykun">@Macleykun</a> for help and tips&tricks for Dockerfile(s):
|
||||||
|
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ function PiaToggleArpScan()
|
|||||||
// laod footer asynchronously not to block the page load/other sections
|
// laod footer asynchronously not to block the page load/other sections
|
||||||
window.onload = function asyncFooter()
|
window.onload = function asyncFooter()
|
||||||
{
|
{
|
||||||
$("#lastCommit").append('<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/pi.alert/main?logo=github&style=plastic">');
|
$("#lastCommit").append('<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/jokob-sk/pi.alert/main?logo=github">');
|
||||||
|
|
||||||
$("#lastDockerUpdate").append(
|
$("#lastDockerUpdate").append(
|
||||||
'<img alt="Docker last pushed" src="https://img.shields.io/badge/dynamic/json?color=blue&label=Last%20pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&?link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert">');
|
'<img alt="Docker last pushed" src="https://img.shields.io/badge/dynamic/json?color=blue&label=Last%20pushed&query=last_updated&url=https%3A%2F%2Fhub.docker.com%2Fv2%2Frepositories%2Fjokobsk%2Fpi.alert%2F&logo=docker&?link=http://left&link=https://hub.docker.com/repository/docker/jokobsk/pi.alert">');
|
||||||
|
|||||||
Reference in New Issue
Block a user