Compare commits

...

6 Commits
v2.55 ... v2.56

Author SHA1 Message Date
pucherot
f8564f4dd7 v2.56
BUGFIX #23
2021-01-15 09:12:52 +01:00
pucherot
78352ed5a4 Merge branch 'main' of https://github.com/pucherot/Pi.Alert into main 2021-01-14 22:35:13 +01:00
pucherot
bb4be279c8 Update front to use .conf 2021-01-14 22:33:34 +01:00
pucherot
9f73af8ce6 Update front to use .conf 2021-01-14 22:30:07 +01:00
pucherot
f6eedd84d8 Update INSTALL.md 2021-01-14 22:11:10 +01:00
pucherot
cd9a1ac22a Update INSTALL.md 2021-01-14 13:25:24 +01:00
8 changed files with 79 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
VERSION = '2.55' VERSION = '2.56'
VERSION_YEAR = '2021' VERSION_YEAR = '2021'
VERSION_DATE = '2021-01-13' VERSION_DATE = '2021-01-15'
DB_PATH = '/home/pi/pialert/db/pialert.db' DB_PATH = '/home/pi/pialert/db/pialert.db'
LOG_PATH = '/home/pi/pialert/log' LOG_PATH = '/home/pi/pialert/log'

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# Pi.Alert v2.55 / 2021-01-13 # Pi.Alert v2.56 / 2021-01-15
# Puche 2020 # Puche 2021
# GNU GPLv3 # GNU GPLv3
@@ -712,16 +712,39 @@ def create_new_devices ():
# DHCP Leases - Create New Devices # DHCP Leases - Create New Devices
print_log ('New devices - 6 DHCP Leases Create devices') print_log ('New devices - 6 DHCP Leases Create devices')
sql.execute ("""INSERT INTO Devices (dev_MAC, dev_name, dev_Vendor, # BUGFIX #23 - Duplicated MAC in DHCP.Leases
dev_LastIP, dev_FirstConnection, dev_LastConnection, # TEST - Force Duplicated MAC
# sql.execute ("""INSERT INTO DHCP_Leases VALUES
# (1610700000, 'TEST1', '10.10.10.1', 'Test 1', '*')""")
# sql.execute ("""INSERT INTO DHCP_Leases VALUES
# (1610700000, 'TEST2', '10.10.10.2', 'Test 2', '*')""")
sql.execute ("""INSERT INTO Devices (dev_MAC, dev_name, dev_LastIP,
dev_Vendor, dev_FirstConnection, dev_LastConnection,
dev_ScanCycle, dev_AlertEvents, dev_AlertDeviceDown, dev_ScanCycle, dev_AlertEvents, dev_AlertDeviceDown,
dev_PresentLastScan) dev_PresentLastScan)
SELECT DHCP_MAC, DHCP_Name, '(unknown)', DHCP_IP, ?, ?, SELECT DISTINCT DHCP_MAC,
1, 1, 0, 1 (SELECT DHCP_Name FROM DHCP_Leases AS D2
FROM DHCP_Leases WHERE D2.DHCP_MAC = D1.DHCP_MAC
ORDER BY DHCP_DateTime DESC LIMIT 1),
(SELECT DHCP_IP FROM DHCP_Leases AS D2
WHERE D2.DHCP_MAC = D1.DHCP_MAC
ORDER BY DHCP_DateTime DESC LIMIT 1),
'(unknown)', ?, ?, 1, 1, 0, 1
FROM DHCP_Leases AS D1
WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE NOT EXISTS (SELECT 1 FROM Devices
WHERE dev_MAC = DHCP_MAC) """, WHERE dev_MAC = DHCP_MAC) """,
(startTime, startTime) ) (startTime, startTime) )
# sql.execute ("""INSERT INTO Devices (dev_MAC, dev_name, dev_Vendor,
# dev_LastIP, dev_FirstConnection, dev_LastConnection,
# dev_ScanCycle, dev_AlertEvents, dev_AlertDeviceDown,
# dev_PresentLastScan)
# SELECT DHCP_MAC, DHCP_Name, '(unknown)', DHCP_IP, ?, ?,
# 1, 1, 0, 1
# FROM DHCP_Leases
# WHERE NOT EXISTS (SELECT 1 FROM Devices
# WHERE dev_MAC = DHCP_MAC) """,
# (startTime, startTime) )
print_log ('New Devices end') print_log ('New Devices end')
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@@ -76,7 +76,7 @@ Estimated time: 20'
5 - Connect to web admin panel 5 - Connect to web admin panel
- http://192.168.1.x/admin/ - http://192.168.1.x/admin/
- (*replace the 192.168.1.x with your Raspberry IP*) - (*replace 192.168.1.x with your Raspberry IP*)
6 - Activate DHCP server 6 - Activate DHCP server
- Pi-hole -> Settings -> DHCP -> Mark "DHCP server enabled" - Pi-hole -> Settings -> DHCP -> Mark "DHCP server enabled"
@@ -84,7 +84,7 @@ Estimated time: 20'
7 - Add pi.alert DNS Record 7 - Add pi.alert DNS Record
- Pi-hole -> Local DNS -> DNS Records -> Add new domain /IP - Pi-hole -> Local DNS -> DNS Records -> Add new domain /IP
- pi.alert 192.168.1.x - pi.alert 192.168.1.x
- (*replace the 192.168.1.x with your Raspberry IP*) - (*replace 192.168.1.x with your Raspberry IP*)
8 - Deactivate your current DHCP Server (*Normaly at your router or AP*) 8 - Deactivate your current DHCP Server (*Normaly at your router or AP*)
@@ -183,14 +183,22 @@ Estimated time: 20'
(crontab -l 2>/dev/null; cat ~/pialert/back/pialert.cron) | crontab - (crontab -l 2>/dev/null; cat ~/pialert/back/pialert.cron) | crontab -
``` ```
9 - Add DB permissions to the web-server user 9 - Add permissions to the web-server user
``` ```
sudo chgrp -R www-data ~/pialert/db sudo chgrp -R www-data ~/pialert/back ~/pialert/back/pialert.conf ~/pialert/front ~/pialert/db
chmod -R 770 ~/pialert/db chmod -R 770 ~/pialert/back ~/pialert/back/pialert.conf ~/pialert/front ~/pialert/db
``` ```
10 - Use admin panel to configure the devices 10 - Check DNS record por pi.alert (explained in point 7 of Pi.hole installing)
- http://pi.alert/ - Add pi.alert DNS Record
- Pi-hole -> Local DNS -> DNS Records -> Add new domain /IP
- pi.alert 192.168.1.x
- (*replace 192.168.1.x with your Raspberry IP*)
11 - Use admin panel to configure the devices
- http://pi.alert/
- http://192.168.1.x/pialert/
- (*replace 192.168.1.x with your Raspberry IP*)
## Device Management ## Device Management

View File

@@ -1,10 +1,28 @@
<!-- Main Footer --> <!-- Main Footer -->
<footer class="main-footer"> <footer class="main-footer">
<!-- Default to the left --> <!-- Default to the left -->
&copy; 2021 Puche
<!--
&copy; 2020 Puche
-->
<?php
$conf_file = '../back/pialert.conf';
$conf_data = parse_ini_file($conf_file);
echo '<span style="display:inline-block; transform: rotate(180deg)">&copy;</span> '. $conf_data['VERSION_YEAR'] .' Puche';
?>
<!-- To the right --> <!-- To the right -->
<div class="pull-right no-hidden-xs"> <div class="pull-right no-hidden-xs">
Pi.alert&nbsp&nbsp2.55&nbsp&nbsp<small>(2021-01-13)</small>
<!--
Pi.alert&nbsp&nbsp2.50&nbsp&nbsp<small>(2019-12-30)</small>
-->
<?php
$conf_file = '../back/pialert.conf';
$conf_data = parse_ini_file($conf_file);
echo 'Pi.alert&nbsp&nbsp'. $conf_data['VERSION'] .'&nbsp&nbsp<small>('. $conf_data['VERSION_DATE'] .')</small>';
?>
</div> </div>
</footer> </footer>

View File

@@ -91,15 +91,20 @@
<li class="user-body"> <li class="user-body">
<div class="row"> <div class="row">
<div class="col-xs-4 text-center"> <div class="col-xs-4 text-center">
<a href="https://github.com/pucherot/Pi.Alert">GitHub</a>
</div> </div>
<div class="col-xs-4 text-center"> <div class="col-xs-4 text-center">
<a href="https://github.com/pucherot/Pi.Alert">Pi.Alert</a> <a href="https://github.com/pucherot/Pi.Alert">GitHub</a>
<!-- <a href="#">Website</a> -->
</div> </div>
<!--
<div class="col-xs-4 text-center">
<a href="https://github.com/pucherot/Pi.Alert">Pi.Alert</a>
</div>
-->
<!--
<div class="col-xs-4 text-center"> <div class="col-xs-4 text-center">
<a href="#">Updates</a> <a href="#">Updates</a>
</div> </div>
-->
</div> </div>
<!-- /.row --> <!-- /.row -->
</li> </li>

View File

@@ -1,16 +1,18 @@
# #
PIALERT_VERSION=2.55 PIALERT_VERSION=`awk '$1=="VERSION" { print $3 }' ../back/pialert.conf | tr -d \'`
PIALERT_DEV_PATH=/media/WD_4TB/dev PIALERT_DEV_PATH=/media/WD_4TB/dev
cd $PIALERT_DEV_PATH cd $PIALERT_DEV_PATH
pwd
ls -l pialert/install/pialert*.tar
tar tvf pialert/install/pialert_latest.tar | wc -l tar tvf pialert/install/pialert_latest.tar | wc -l
rm pialert/install/pialert_*.tar rm pialert/install/pialert_*.tar
tar cvf pialert/install/pialert_$PIALERT_VERSION.tar --exclude="pialert/install" --exclude="pialert/.git" pialert | wc -l tar cvf pialert/install/pialert_$PIALERT_VERSION.tar --exclude="pialert/install" --exclude="pialert/.git" pialert | wc -l
# rm pialert/install/pialert_latest.tar
ln -s pialert_$PIALERT_VERSION.tar pialert/install/pialert_latest.tar ln -s pialert_$PIALERT_VERSION.tar pialert/install/pialert_latest.tar
ls -l pialert/install/pialert*.tar

Binary file not shown.