jokob-sk / NetAlertX

🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
3.1k stars 187 forks source link

New version is broken? #112

Closed viriatusX closed 1 year ago

viriatusX commented 1 year ago

Good afternoon, since the last update, docker is constantly restarting. It does not work. what could it be?

My docker-compose:

version: '3.5'

services:

pialert: container_name: pialert image: jokobsk/pi.alert:latest volumes:

volumes: pialert_db: external: true


Captura de Pantalla 2022-12-08 a las 18 43 32
mrulke commented 1 year ago

yeah im having the same issue

jokob-sk commented 1 year ago

Hi there!

I rewrote a big chunk of the code, so bugs are possible and I expected some, so thanks for raising the issue.

I'm running the container for a week without issues, but I don't use the pihole integration.

@mrulke Are you using a pihole DB? I f yes, I can try it on my end.

Otherwise, can you have a look at the logs to see if there are any relevant errors?

@viriatusX Can you try mounting the DB file directly just for testing?

You can map the log folder as per Example 1:

https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#example-1

I can build a DEV image with more debugging output, but let's see if we can find something on this one.

Thanks in advance for the help! j

faileador1 commented 1 year ago

As described in first post.

Two NAS with same config, updated one is not working, constantly restarting pialert container.

jokob-sk commented 1 year ago

Hi @faileador1 ,

As per above, can you please provide me more details?

Otherwise, can you have a look at the logs to see if there are any relevant errors? Are you using pihole?

You can map the log folder as per Example 1:

https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#example-1

Cheers in advance! j

viriatusX commented 1 year ago

Hi @faileador1 ,

As per above, can you please provide me more details?

Otherwise, can you have a look at the logs to see if there are any relevant errors? Are you using pihole?

You can map the log folder as per Example 1:

https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#example-1

Cheers in advance! j

Hi! This shows my log:

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 51, in exec(open(PIALERT_PATH + "/config/pialert.conf").read()) File "", line 21, in NameError: name 'SMTP_USER' is not defined


And the SMTP is disabled for me in pialert.conf.

Thanks!!

faileador1 commented 1 year ago

Hi @faileador1 ,

As per above, can you please provide me more details?

Otherwise, can you have a look at the logs to see if there are any relevant errors? Are you using pihole?

You can map the log folder as per Example 1:

https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#example-1

Cheers in advance! j

pialert.log

`#=#=#

O#-

O=

=#=-

                                                                       0.4%

####### 9.8% ############################### 43.9% ##################################################### 74.4% ######################################################################## 100.0%

=#=

O#-

O=

                                                                       0.1%

1.5%

6.6%

######## 11.6% ############ 16.9% ############### 22.2% ################### 27.5% ####################### 32.9% ########################### 38.3% ############################### 43.6% ################################### 49.0% ####################################### 54.4% ########################################## 59.7% ############################################## 64.1% ################################################## 70.0% ###################################################### 75.4% ######################################################### 80.1% ############################################################# 86.1% ################################################################# 91.4% ##################################################################### 96.6% ######################################################################## 100.0%

=#=

O#-

O=

                                                                       0.3%
7.5%

######### 13.2% ########### 16.1% ############## 20.4% ################## 25.3% ##################### 30.5% ########################## 37.1% ############################# 40.4% ################################# 46.9% ###################################### 53.5% ########################################### 60.0% ############################################# 63.3% ################################################## 69.9% #################################################### 73.1% ######################################################### 79.7% ########################################################## 81.8% ############################################################### 88.3% #################################################################### 94.9% ######################################################################## 100.0%

=#=

O#-

                                                                       0.2%

4.4%

7.6%
9.3%

######## 11.2% ######### 13.6% ########### 15.4% ############ 17.6% ############## 20.4% ################# 24.3% ################## 26.2% ##################### 30.1% ####################### 32.0% ######################## 33.9% ########################### 37.8% ############################ 39.7% ############################### 43.6% ################################ 45.5% ################################### 48.6% ##################################### 52.5% ####################################### 54.4% ######################################### 58.3% ############################################ 62.1% ############################################## 64.1% ############################################### 66.0% ################################################### 71.8% ##################################################### 73.7% ####################################################### 77.6% ########################################################## 81.4% ############################################################# 85.3% ################################################################ 89.1% ################################################################## 93.0% ####################################################################### 98.8% ######################################################################## 100.0%

=#=

O#-

O=

=#=-

                                                                       0.3%
7.9%

########## 14.0% ############ 17.1% ############## 20.4% ################# 24.1% #################### 28.3% ####################### 32.0% ########################### 37.6% ############################# 41.0% ################################## 48.0% ##################################### 51.4% ########################################## 58.4% ############################################ 61.8% ################################################# 68.8% ###################################################### 75.7% ######################################################## 79.2% ############################################################# 86.1% ################################################################ 90.3% ################################################################### 93.7% ######################################################################## 100.0% `

mrulke commented 1 year ago

I am using pi hole but have not set it up in pi alert.

On Sat, 10 Dec 2022, 10:53 pm jokob-sk, @.***> wrote:

Hi @faileador1 https://github.com/faileador1 ,

As per above, can you please provide me more details?

Otherwise, can you have a look at the logs to see if there are any relevant errors? Are you using pihole?

You can map the log folder as per Example 1:

https://github.com/jokob-sk/Pi.Alert/tree/main/dockerfiles#example-1

Cheers in advance! j

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1345247819, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2L3JEK5TMCGOROFVXE6QTWMRVKJANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk commented 1 year ago

@viriatusX

Thanks for that!

That means that even previously, PiAlert probably wasn't working properly. Now the difference is that at least it fails, so you notice it's not working. If you don't use email reporting (I assume you don't since you don't have SMTP_USER defined), set REPORT_MAIL = False in your pialert.conf file.

I'm looking into making the error logs more accessible and logging a bit more cleaner to debug your issue @faileador1 as well.

Will get back once I have a new image for you to test.

@mrulke Do you have anything relevant in your logs?

Thanks in advance, j

mrulke commented 1 year ago

No that I can see I'll try again tonight.

On Sun, 11 Dec 2022, 10:50 am jokob-sk, @.***> wrote:

@viriatusX https://github.com/viriatusX

Thanks for that!

That means that even previously, PiAlert probably wasn't working properly. Now the difference is that at least it fails, so you notice it's not working. If you don't use email reporting (I assume you don't since you don't have SMTP_USER defined), set REPORT_MAIL = False in your pialert.conf file.

I'm looking into making the error logs more accessible and logging a bit more cleaner to debug your issue @faileador1 https://github.com/faileador1 as well.

Will get back once I have a new image for you to test.

@mrulke https://github.com/mrulke Do you have anything relevant in your logs?

Thanks in advance, j

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1345410758, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2L3JFPQNQFHC7IGRF2YT3WMUJKTANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

viriatusX commented 1 year ago

@viriatusX

¡Gracias por eso!

That means that even previously, PiAlert probably wasn't working properly. Now the difference is that at least it fails, so you notice it's not working. If you don't use email reporting (I assume you don't since you don't have SMTP_USER defined), set REPORT_MAIL = False in your pialert.conf file.

I'm looking into making the error logs more accessible and logging a bit more cleaner to debug your issue @faileador1 as well.

Volveré cuando tenga una nueva imagen para que la pruebes.

@mrulke¿Tienes algo relevante en tus registros?

Gracias de antemano,julio

Thanks for your help.

Now the logs shows:


sudo: unable to resolve host pialert: Name or service not known sudo: unable to resolve host pialert: Name or service not known sudo: unable to resolve host pialert: Name or service not known sudo: unable to resolve host pialert: Name or service not known

=#=

O#-

O=

=#=-

                                                                       0.4%

4.5%

7.5%

####### 10.6% ######## 11.7% ########## 14.7% ########### 15.9% ############# 18.1% ############## 20.4% ################ 22.3% ################## 25.3% ################## 25.7% ################### 26.4% #################### 28.7% ##################### 30.2% ####################### 32.5% ######################## 34.4% ######################### 34.7% ############################ 39.0% ############################### 43.3% ################################## 47.6% ##################################### 51.9% ######################################## 56.2% ########################################### 60.5% ############################################## 64.8% ################################################# 69.1%


jokob-sk commented 1 year ago

@viriatusX

Great, we are making progress!

How did you set your SCAN_SUBNETS variable?

jokob-sk commented 1 year ago

In the latest image:

I've built a crude Logs section and made sure the logs are updated more frequently than before. This might help you to debug your issues easier.

image

Please note, I had to move the logs location form:

to

So change your docker-compose mappings if needed.

mrulke commented 1 year ago

Looks like it is working for me now. Added my extra networks as well. Awesome stuff

On Sun, 11 Dec 2022, 10:41 pm jokob-sk, @.***> wrote:

In the latest image:

I've built a crude Logs section and made sure the logs are updated more frequently than before. This might help you to debug your issues easier.

[image: image] https://user-images.githubusercontent.com/96159884/206901403-52f4ce32-5abc-491e-98bc-a2be603860fb.png

Please note, I had to move the logs location form:

  • home/pi/pialert/log

to

  • home/pi/pialert/front/log

So change your docker-compose mappings if needed.

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1345530820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2L3JF7VQF2FUH75BKZXP3WMW4WPANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

jokob-sk commented 1 year ago

Great! Glad to hear it's working. :)

I'm keeping this issue open for a couple of days or until @viriatusX @faileador1 reply with updates..

danktankk commented 1 year ago

I am also having issue with getting this to see VLANS using an ESXi v8 Ubuntu Server 22.04 VM. Im not sure its related to the version however. I am still testing.

After trying for a few hours, I cant seem to get this to see anything other than the local network regardless of my efforts. I do realize that ARP is layer 2, but I know there is a way to get this to see multiple VLANS, however the documentation is not very good on this. Especially for VM's. Any help would be appreciated.

Scanning... arp-scan Method... arp-scan: One interface Pi-hole Method... DHCP Leases Method...

I would like to integrate pihole as well, but its on a separate machine completely and I have not seen a way to add it with any guide for that either.

jokob-sk commented 1 year ago

Hi @danktankk ,

Can you post your docker-compose? I'm not sure what multiple VLANS are, but to scan multiple interfaces use this approach:

AFAIK you need to have access to piholes DB to use it, so they need to be installed on the same HW or at least made available via a mount in the PiAlert container. I myself am not using pihole so can't comment on this approach in more detail.

If the README is not specific enough, please do let me know how to improve it.

Thanks, j

mrulke commented 1 year ago

I am using an interface on each vlan as it uses arp to find devices and you can't arp cross subnets.


From: jokob-sk @.> Sent: Tuesday, December 13, 2022 7:04:52 PM To: jokob-sk/Pi.Alert @.> Cc: mrulke @.>; Mention @.> Subject: Re: [jokob-sk/Pi.Alert] New version is broken? (Issue #112)

Hi @danktankkhttps://github.com/danktankk ,

Can you post your docker-compose? I'm not sure what multiple VLANS are, but to scan multiple interfaces use this approach:

AFAIK you need to have access to piholes DB to use it, so they need to be installed on the same HW or at least made available via a mount in the PiAlert container. I myself am not using pihole so can't comment on this approach in more detail.

If the README is not specific enough, please do let me know how to improve it.

Thanks, j

— Reply to this email directly, view it on GitHubhttps://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1347895308, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC2L3JHJQ6POG7J44YFH26DWNAU2JANCNFSM6AAAAAASYNHVGM. You are receiving this because you were mentioned.Message ID: @.***>

danktankk commented 1 year ago

I am using an interface on each vlan as it uses arp to find devices and you can't arp cross subnets.

Thats what I was afraid of as ARP is layer 2. I ahve read about a few different implementations where it will traverse layer 3, but im afraid my pay grade isnt high enough to implement that. I have 5 VLANS so I guess that means I will need to add in 5 vnetwork cards to my VM to see this traffic :.. ergggg

Or.. Perhaps.... An easier way might be using my pihole rpi3? How would I map my pihole that lives on the same network as this VM?

I have the VM running ubuntu server on 192.168.1.0/24 network - add pihole running on same 192.168.1.0/24 network

This PiHole can see the other VLANS already. Is there a way (I dont particularly care if its easy) to add this pihole to the pialert.conf file on my VM? Ill admit I have tried a few times without success.

danktankk commented 1 year ago

Hi @danktankk ,

Can you post your docker-compose? I'm not sure what multiple VLANS are, but to scan multiple interfaces use this approach:

  • Examples for one and two subnets:

    • SCAN_SUBNETS = '192.168.1.0/24 --interface=eth0'
    • SCAN_SUBNETS = ['192.168.1.0/24 --interface=eth0', '192.168.1.0/24 --interface=eth1']

AFAIK you need to have access to piholes DB to use it, so they need to be installed on the same HW or at least made available via a mount in the PiAlert container. I myself am not using pihole so can't comment on this approach in more detail.

If the README is not specific enough, please do let me know how to improve it.

Thanks, j

Thank you for the reply... Multiple VLANS simply means you are using network hardware capable of separating network traffic for a variety of reasons (managed vs unmanaged switches). The reason for VLANS here isn't particularly important (i.e. security, segregation, minimalization, control, automation, IoT, NoT, etc), but needs mention due to this implementation using a layer 2 protocol - ARP - as the main way to poll devices.

If you implement a solution that uses layer 2, then you literally will need a dedicated NIC to poll each VLAN (Virtual Local Area Network) that also goes through a managed switch (which is not surprising at all). In the case of a VM, you could in practice add multiple nics virtually to do this job. I do not like this solution however as I have too many VLANS for this to be feasable.

I guess my only alternative would be to map the pihole to my VM and then somehow tell it to look there....

i am better at networking than I am at linuxing.... :|

So, for anyone that cares to help.. I have an ESXi 8 VM Ubuntu Server 22.04 that I will need to mount the pihole db share to. This is probably easy for the raspbian, debain, or slackware aficionado. I will then have to tell the conf where to look as well. Any help is most appreciated.

viriatusX commented 1 year ago

Sorry for my late response @jokob-sk . I just updated to the latest version.

I had an old pialert.conf. In the new one, I can't find the Pi.Alert.DB path. What I have done is to map the DB directly from the container.

Captura de Pantalla 2022-12-16 a las 11 53 07 Captura de Pantalla 2022-12-16 a las 11 39 58

MY CURRENT LOG

Loop start

Check Internet IP Timestamp:2022-12-16 11:38:00

Retrieving Internet IP...

xxxxxxxxx (MY PUBLIC IP) Retrieving previous IP... xxxxxxxxx (MY PUBLIC IP) No changes to perform

Skipping Dynamic DNS update...

Scan Devices ScanCycle:1 Timestamp:2022-12-16 11:38:00

Scanning... arp-scan Method... arp-scan: One interface Pi-hole Method... DHCP Leases Method...

Processing scan results... Devices Detected.......:8 arp-scan Method....:6 Pi-hole Method.....: +0 New Devices........: 0

Devices in this cycle..: 8
    Down Alerts........: 0
    New Down Alerts....: 0
    New Connections....: 6
    Disconnections.....: 0
    IP Changes.........: 0

Updating DB Info... Sessions Events (connect / discconnect) ... Creating new devices... Updating Devices Info... Trying to resolve devices without name...

    Names updated:  0
Voiding false (ghost) disconnections...
Pairing session events (connection / disconnection) ...
Creating sessions snapshot...
Skipping repeated notifications...

Check if something to report... No changes to report... Notifications:6 Cleanup Database Timestamp:2022-12-16 11:38:00 Cleanup Online_History... Optimize Database... Cleanup Events, up to the lastest 90 days... Shrink Database...

Finished cycle: cleanup

Loop end

Wait 20s

Wait 20s

Loop start

Loop end

Wait 20s


My Pi.Alert home...

Captura de Pantalla 2022-12-16 a las 11 42 01

My pialert.conf:

Captura de Pantalla 2022-12-16 a las 11 42 53

The container seems to load correctly, but the web interface is slow, and does not display anything. Thanks!

jokob-sk commented 1 year ago

Hey @viriatusX !

Looks like the backend works fine now, which is great. I think your DB should be updated correctly.

Now I think the issue is that the pialert.db doesn't have correct permissions. I think the nginx user doesn't have RW permissions on the DB file. You can try to go nuclear and run chmod +777 pialert.db on your host or/and in the container.

You can also check the dev tools in chrome/firefox (F12) if you can see any errors, but I think it's the DB permissions thing.

Thanks, j

jokob-sk commented 1 year ago

Hi @danktankk,

Not sure if I'll be able to help with network related stuff. Layer 2 etc talk is a bit more than what I'm familiar with. If you have pihole working, then that might be a workaround. Check the sample pialert.conf and use the relevant PiHole settings.

An alternative, if you by any chance use Home Assistant, and if you get PiAlert working on all VLANS, you can use Home Assistant as your 'hub'. You point all PiAlert instances to one Home Assistant (HA) instance and use the MQTT integration to sync the devices into HA.

j

viriatusX commented 1 year ago

Hey @viriatusX !

Looks like the backend works fine now, which is great. I think your DB should be updated correctly.

Now I think the issue is that the pialert.db doesn't have correct permissions. I think the nginx user doesn't have RW permissions on the DB file. You can try to go nuclear and run chmod +777 pialert.db on your host or/and in the container.

You can also check the dev tools in chrome/firefox (F12) if you can see any errors, but I think it's the DB permissions thing.

Thanks, j

Captura de pantalla 2022-12-17 a las 0 17 59

Hi! I checked and the pialert.db is set to 777. ANd I not see any errors with firefox.

jokob-sk commented 1 year ago

Can you please try rebuilding / redownloading the image?

On Sat, 17 Dec 2022, 10:19 viriatusX, @.***> wrote:

Hey @viriatusX https://github.com/viriatusX !

Looks like the backend works fine now, which is great. I think your DB should be updated correctly.

Now I think the issue is that the pialert.db doesn't have correct permissions. I think the nginx user doesn't have RW permissions on the DB file. You can try to go nuclear and run chmod +777 pialert.db on your host or/and in the container.

You can also check the dev tools in chrome/firefox (F12) if you can see any errors, but I think it's the DB permissions thing.

Thanks, j

[image: Captura de pantalla 2022-12-17 a las 0 17 59] https://user-images.githubusercontent.com/64467637/208204086-62eb4be0-47b4-457e-a4d5-d2042d82b83e.png

Hi! I checked and the paler.db is set to 777. ANd I not see any errors with firefox.

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1355786295, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDGTGZJEEPL5GXBXSS3WNT2IHANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

viriatusX commented 1 year ago

Yes, look the log. there is a problem with "mkdir: cannot create directory '/run/php': File exists". this problem is shown in the log, since the version that started to go wrong.

Captura de pantalla 2022-12-17 a las 0 37 48
jokob-sk commented 1 year ago

I think that's a common warning and not related to the problem. I can however see that your subnets variable is not configured correctly.

You seem to use eth1 which doesn't exist on your server. Can you please look into this?

On Sat, 17 Dec 2022, 10:39 viriatusX, @.***> wrote:

Can you please try rebuilding / redownloading the image? … <#m1684676160071993091> Yes, look the log. there is a problem with "mkdir: cannot create directory '/run/php': File exists". this problem is shown in the log, since the version that started to go wrong.

[image: Captura de pantalla 2022-12-17 a las 0 37 48] https://user-images.githubusercontent.com/64467637/208208217-422eca64-6aea-4947-8bac-886961d1d963.png

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1355827986, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDCO7SSYNVEGXQNVZBLWNT4UHANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

viriatusX commented 1 year ago

Could this be the problem? How do I change the "eth1" interface? In my case I use Link Aggregation on the Synology and the web interface is "bond0".

Captura de pantalla 2022-12-17 a las 1 01 13
viriatusX commented 1 year ago

UPDATE WITH: SCAN_SUBNETS = '--localnet --interface=bond0' Now PiAlert detects 21 devices. All seems correct but Web Interface appears wrong too...shows nothing. It seems to be a PHP or web interface error...

If I try to change settings in the web interface such as language, etc., and click "apply", no changes are applied. The error is either the DB or some part of the Web Interface files. Could you send me the pialert.db file?

And the logs shows this error: sudo: unable to resolve host pialert: Name or service not known


Skipping Dynamic DNS update...

Scan Devices ScanCycle:1 Timestamp:2022-12-17 01:05:00

Scanning... arp-scan Method... arp-scan: One interface sudo: unable to resolve host pialert: Name or service not known

Pi-hole Method...
DHCP Leases Method...

Processing scan results... Devices Detected.......:21 arp-scan Method....:19 Pi-hole Method.....: +0 New Devices........: 14

Devices in this cycle..: 7
    Down Alerts........: 0
    New Down Alerts....: 0
    New Connections....: 0
    Disconnections.....: 0
    IP Changes.........: 0

Updating DB Info... Sessions Events (connect / discconnect) ... Creating new devices... Updating Devices Info... Trying to resolve devices without name...

    Names updated:  7
Voiding false (ghost) disconnections...
Pairing session events (connection / disconnection) ...
Creating sessions snapshot...
Skipping repeated notifications...

Check if something to report...

Changes detected, sending reports... Skip mail... Skip Apprise... Skip webhook... Skip NTFY... Skip PUSHSAFER... Skip MQTT... Notifications:14 Cleanup Database Timestamp:2022-12-17 01:05:00 Cleanup Online_History... Optimize Database... Cleanup Events, up to the lastest 90 days... Shrink Database...

Finished cycle: cleanup

Loop end

Wait 20s

jokob-sk commented 1 year ago

Great, getting there.

Can you confirm you run chmod +777 pialert.db inside of the container? Not on the server.

On Sat, 17 Dec 2022, 11:07 viriatusX, @.***> wrote:

UPDATE:

Skipping Dynamic DNS update...

Scan Devices ScanCycle:1 Timestamp:2022-12-17 01:05:00

Scanning... arp-scan Method... arp-scan: One interface sudo: unable to resolve host pialert: Name or service not known

Pi-hole Method... DHCP Leases Method...

Processing scan results... Devices Detected.......:21 arp-scan Method....:19 Pi-hole Method.....: +0 New Devices........: 14

Devices in this cycle..: 7 Down Alerts........: 0 New Down Alerts....: 0 New Connections....: 0 Disconnections.....: 0 IP Changes.........: 0

Updating DB Info... Sessions Events (connect / discconnect) ... Creating new devices... Updating Devices Info... Trying to resolve devices without name...

Names updated:  7

Voiding false (ghost) disconnections... Pairing session events (connection / disconnection) ... Creating sessions snapshot... Skipping repeated notifications...

Check if something to report...

Changes detected, sending reports... Skip mail... Skip Apprise... Skip webhook... Skip NTFY... Skip PUSHSAFER... Skip MQTT... Notifications:14 Cleanup Database Timestamp:2022-12-17 01:05:00 Cleanup Online_History... Optimize Database... Cleanup Events, up to the lastest 90 days... Shrink Database...

Finished cycle: cleanup Loop end

Wait 20s

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1355853548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDGIT2O6NUJ54VOX4FLWNT72TANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: <jokob-sk/Pi .@.***>

viriatusX commented 1 year ago

Yes, look:

Captura de pantalla 2022-12-17 a las 1 22 13
jokob-sk commented 1 year ago

Also don't use '--localnet' but your actual network mask or how it is called. Check the sample pialert.conf for examples.

On Sat, 17 Dec 2022, 11:20 Boris Pocatko, @.***> wrote:

Great, getting there.

Can you confirm you run chmod +777 pialert.db inside of the container? Not on the server.

On Sat, 17 Dec 2022, 11:07 viriatusX, @.***> wrote:

UPDATE:

Skipping Dynamic DNS update...

Scan Devices ScanCycle:1 Timestamp:2022-12-17 01:05:00

Scanning... arp-scan Method... arp-scan: One interface sudo: unable to resolve host pialert: Name or service not known

Pi-hole Method... DHCP Leases Method...

Processing scan results... Devices Detected.......:21 arp-scan Method....:19 Pi-hole Method.....: +0 New Devices........: 14

Devices in this cycle..: 7 Down Alerts........: 0 New Down Alerts....: 0 New Connections....: 0 Disconnections.....: 0 IP Changes.........: 0

Updating DB Info... Sessions Events (connect / discconnect) ... Creating new devices... Updating Devices Info... Trying to resolve devices without name...

Names updated:  7

Voiding false (ghost) disconnections... Pairing session events (connection / disconnection) ... Creating sessions snapshot... Skipping repeated notifications...

Check if something to report...

Changes detected, sending reports... Skip mail... Skip Apprise... Skip webhook... Skip NTFY... Skip PUSHSAFER... Skip MQTT... Notifications:14 Cleanup Database Timestamp:2022-12-17 01:05:00 Cleanup Online_History... Optimize Database... Cleanup Events, up to the lastest 90 days... Shrink Database...

Finished cycle: cleanup Loop end

Wait 20s

— Reply to this email directly, view it on GitHub https://github.com/jokob-sk/Pi.Alert/issues/112#issuecomment-1355853548, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW5URDGIT2O6NUJ54VOX4FLWNT72TANCNFSM6AAAAAASYNHVGM . You are receiving this because you were mentioned.Message ID: @.***>

jokob-sk commented 1 year ago

A few things to try:

  1. One test which you can run is not to map the DB file in docker-compose. If everything loads with the default DB then it's almost certainly an issue with the permissions on your currently mapped DB file.

  2. Also, if you can share your current (without personal info) pialert.conf and docker-compose.yml files so I can see the current state of things.

If I try to change settings in the web interface such as language, etc., and click "apply", no changes are applied.

  1. This again seems to point to file access permission issues. Did you try to map your docker UID/GID to your servers? You can do it via the environment variables as described here point number 2 and in Example 1.

Could you send me the pialert.db file?

  1. You can download a blank DB file as per instructions, bullet point 1.
viriatusX commented 1 year ago

Without manually mapping the DB, now runs!!!!!. Is there any problem for not mapping the DB in the Compose? Thanks!!!

danktankk commented 1 year ago

Hi @danktankk,

Not sure if I'll be able to help with network related stuff. Layer 2 etc talk is a bit more than what I'm familiar with. If you have pihole working, then that might be a workaround. Check the sample pialert.conf and use the relevant PiHole settings.

An alternative, if you by any chance use Home Assistant, and if you get PiAlert working on all VLANS, you can use Home Assistant as your 'hub'. You point all PiAlert instances to one Home Assistant (HA) instance and use the MQTT integration to sync the devices into HA.

j

Thanks for the reply. I dont know that I will be able to get this to work to see all of my network. This layer 2 limitation is a killer. I do have some alternatives that I could try i suppose.

I could install this on the actual raspberry pi (but I would rather not).

I could try using smb instead of nfs. I have nfs set up and working so that pialert on my ubuntu server can see pihole-FTL.log, but it still doesnt populate any ip addresses other than the network in which pialert resides. Im not sure if its a permissions issue or what.

Very frustrasting

jonas740 commented 1 year ago

i cant even get it to run although i followed all the instructions to the DOT!

Very strange way to set up a docker container from my point of view.

`Loop start

sys.exit(main())       

File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Loop start

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Loop start

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in Loop start

sys.exit(main())       

File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Loop start

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Loop start

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database mkdir: cannot create directory '/run/php': File exists Starting nginx: nginx. Loop start

Traceback (most recent call last): File "/home/pi/pialert/back/pialert.py", line 2352, in sys.exit(main())
File "/home/pi/pialert/back/pialert.py", line 170, in main upgradeDB() File "/home/pi/pialert/back/pialert.py", line 2099, in upgradeDB  openDB() File "/home/pi/pialert/back/pialert.py", line 2173, in openDB sql_connection.execute('pragma journal_mode=wal') # sqlite3.DatabaseError: file is not a database`

jokob-sk commented 1 year ago

Hi @viriatusX ,

Without manually mapping the DB, now runs!!!!!. Is there any problem for not mapping the DB in the Compose? Thanks!!!

Great, so as I thought, the issue are DB permissions,. I think you can get it working if you set the HOST_USER_ID and HOST_USER_GID env variables. If you use PiHole for that than theoretically it shouldn't matter too much, but any setting on the device itself managed in PiAlert will be lost. E..g. you'd lose your custom names of the devices if you use PiAlert to name them after a container rebuild.

j

jokob-sk commented 1 year ago

@jonas740

Please make sure you map the DB file as per instructions. Seems like you are missing it. If the issue persists please open a new issue, this one is veering off-topic.

jokob-sk commented 1 year ago

Hey @danktankk !

Yeah, sorry to leave you hanging, but I think that's as much advice I can give on networking related stuff.

I could try using smb instead of nfs. I have nfs set up and working so that pialert on my ubuntu server can see pihole-FTL.log, but it still doesnt populate any ip addresses other than the network in which pialert resides. Im not sure if its a permissions issue or what.

For testing try copying the below files manually to your server to make sure it's not network related.

Hope this helps, j

danktankk commented 1 year ago

hehe ive installed this on the actual pihole server and it still doesnt work. Looks like this needs more work. Ill check back at some point

jokob-sk commented 1 year ago

@danktankk I don't support direct installs on the HW, only docker deployments for this, but you can give this fork a go if interested: https://github.com/leiweibau/Pi.Alert/

I haven't seen your config files so maybe you are missing a setting. either way, feel free to try in the future - also please open a separate issue as this one is now a bit over-crowded with different support requests. 😉

jokob-sk commented 1 year ago

I'm closing this as some issues have been fixed and it's a bit hard to keep track of everyone's setups and configurations. Feel free to open new issues if you are still facing problems and I will reply in the newly created issues.