leiweibau / Pi.Alert

Scan the devices connected to your WIFI / LAN and alert you the connection of unknown devices. It also warns if a "always connected" device disconnects. In addition, it is possible to check web services for availability. For this purpose HTTP status codes and the response time of the service are evaluated.
https://leiweibau.net
GNU General Public License v3.0
342 stars 25 forks source link

Arp-Scan not running after first install #230

Closed Vorteth closed 6 months ago

Vorteth commented 6 months ago

The installation goes as expected and arp-scan works.

How past install if I power off a device or power on one and look at it in particular it will not update.

The scan countdown goes from 0 to 4:60 immediately and doesn't seem to scan.

I've tried:

  1. Updating permissions using the cli to the home profile
  2. Uninstalling and autopurging arp-scan for a fresh install. Even with this fresh install and no other modifications it just doesn't run.

Any thoughts? I love this product but currently it doesn't seem to see changes.

Vorteth commented 6 months ago

The scan log never changes from this as well:

image

leiweibau commented 6 months ago

The scan countdown goes from 0 to 4:60 immediately and doesn't seem to scan.

You've noticed that correctly, because the scan starts at 0 (when you refresh the page, the scan status should say "1 scan(s)...") and the countdown counts down again from 5 minutes when the next scan starts. Or to put it another way: The coutdown should only help to estimate when the next scan will start, it is not live monitoring.

The scan log never changes from this as well:

Because once the page is generated, it no longer changes automatically. Your screenshot shows that a scan is apparently currently running because the log has just been deleted by the scan. At this point, however, the page has remembered that the log is currently empty. Simply refresh the settings page after 2-3 minutes and check that the scan status shows a 0 (Not the Countdown, a 0 at the beginning) again. Then the log should also be visible.

Vorteth commented 6 months ago

This is still like this after hours. Refreshing when it hits the 5 minute mark just has the same count down and never changes from 0 scans running.

It's like it can't access arp scan.

leiweibau commented 6 months ago

As which user have you installed pialert on which system?

Vorteth commented 6 months ago

I installed it as my default user, named 'pi', if the install log file would be helpful I can send that along.

I copied your install.sh script exactly as from git.

leiweibau commented 6 months ago

What is the Output of this command? python3 $HOME/pialert/back/pialert.py 1

Vorteth commented 6 months ago

See attached photo, it works and also flags the unit as offline which is my 'test' unit to see if it's working.

Screenshot_20240110-122958

Vorteth commented 6 months ago

I just powered on the device in question, waiting for the timer to hit 0

Vorteth commented 6 months ago

After it hit 0 it continued to count down from 5 minutes, no scan in progress and unit offline in the database.

I ran your python text again and it noticed the unit as online.

leiweibau commented 6 months ago

Okay. Everything is Fine. The scan starts. When the countdown starts again at 5 min and you refresh the page, the status box on the Settings page should say something like

Scan Status 1 scan(s) currently running

Vorteth commented 6 months ago

Unfortunately that doesn't happen.

Is it possible something in cron is broken?

Vorteth commented 6 months ago

It won't let me upload the video, however you can see it in this link: https://photos.app.goo.gl/KHRo66DGTKEUT3pb7

Vorteth commented 6 months ago

Let me know and I can try to capture a shorter time the link doesn't work for you.

Vorteth commented 6 months ago

It sounds like as a work around I could however cron this scan, I imagine that's not a good idea however since that may conflict if it ever starts working?

leiweibau commented 6 months ago

Okay, i see 🤔 Can you please run

cd $HOME/pialert/back
sudo ./pialert-cli set_sudoers
leiweibau commented 6 months ago

Can you show me your user cron? crontab -l

Vorteth commented 6 months ago

Crontab below, working on the other two:

Screenshot_20240110-130751

Vorteth commented 6 months ago

Set sudoers

Vorteth commented 6 months ago

Waiting for the next scan to time down.

Vorteth commented 6 months ago

You didn't ask but in case it's relevant Screenshot_20240110-131217

leiweibau commented 6 months ago

This cron is totally broken

0 3 * * 1      python3 $HOME/pialert/back/pialert.py update_vendors >$HOME/pialert/log/pialert.vendors.log  2>&1
*/3 * * * *    python3 $HOME/pialert/back/pialert.py internet_IP    >$HOME/pialert/log/pialert.IP.log       2>&1
*/5 * * * *    python3 $HOME/pialert/back/pialert.py 1              >$HOME/pialert/log/pialert.1.log        2>&1
0 2 * * */4    python3 $HOME/pialert/back/pialert.py cleanup        >$HOME/pialert/log/pialert.cleanup.log  2>&1

remove

15* "/home/pi/pialert/back/pialert-cli" reporting_test
15 0 15 * * "/home/pi/pialert/back/pialert-cli" reporting_test
# Testing to ensure 
#20 * * * * "/home/pi/pialert/back/pialert-cli" reporting_test
* 
Vorteth commented 6 months ago

I added the reporting tests myself so it checks the notifications every two weeks even if an event didn't happen, that's not possible? Or you think that just tripped up the script to add the cron data?

Vorteth commented 6 months ago

Applied cron lines you added and rebooted. Should I remove the reporting ones I made?

leiweibau commented 6 months ago

Okay, you can leave it in if you want. But the lines from me have to go in. A restart is not necessary

Vorteth commented 6 months ago

Waiting for the next window to auto start.

Vorteth commented 6 months ago

AHHH HAH, it is running now.

However the interface seems to be 'disconnected', it never says '1 scan in progress' it always says 0, however I can confirm it's outputting to the log.

Would removing the cron items and doing a clean install perhaps fix this?

leiweibau commented 6 months ago

Once it's up and running, leave it at that for the time being. I will check the source code again in the next few days.

Vorteth commented 6 months ago

You got it, I won't reinstall and will leave it as is. THANK YOU VERY MUCH!!!

Did you want me to leave this open or close it out?

leiweibau commented 6 months ago

I will close it, after i checked the code.

leiweibau commented 6 months ago

The process counter was tested both with $HOME and with "~" in the crontab. The fix will come with the next update

Vorteth commented 6 months ago

Cool, thank you!