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
406 stars 28 forks source link

[Feature Request] Update button and stop database #210

Closed TheCableGuy99 closed 9 months ago

TheCableGuy99 commented 9 months ago

Hi,

I was wondering if you can add a button on the page after checking for updates to update Pi.Alert if there is an update? Each time I update I have to come back here looking for the command. It's not a huge issue but certainly a lot more convenient to just press a button on the Pi.Alert page.

Also, I noticed when running the script, it says to shut down the database to avoid corruption, can this not be added to shut it down and then check the pid to ensure it has closed down before continuing then restart it after?

Just a couple of small things to make life easier?

Thanks for your consideration!

leiweibau commented 9 months ago

Hello

I was wondering if you can add a button on the page after checking for updates to update Pi.Alert if there is an update? Each time I update I have to come back here looking for the command. It's not a huge issue but certainly a lot more convenient to just press a button on the Pi.Alert page.

Unfortunately, this is not quite as trivial as it seems at first. On the one hand, it may be that I also want to update the script that performs the update, but this is not possible if it is currently running. On the other hand, the user www-data would have to be given even more admin rights, which I would like to avoid. However, I can display the update command in the frontend.

Also, I noticed when running the script, it says to shut down the database to avoid corruption, can this not be added to shut it down and then check the pid to ensure it has closed down before continuing then restart it after?

To be honest, I also end all scans "hard", but I would like to give everyone the opportunity to consciously reconsider at this point whether the current scan has run through. I don't want to break anything by killing the process.

leiweibau commented 9 months ago

It will look like this after the next update.

update
TheCableGuy99 commented 9 months ago

Thanks for this, i personally run the app under the root user as i've not concerns, it's all internal and i'm happy with my security setup. But the command on the same page will help :)

As for the shutting down of the database, i'm taking from what you said that you shut it down hard but it could cause issues so we should shut it down gracefully.

Problem is, I don't know how to see if a scan is running or how to shut it down once one isn't?

Maybe you could add a little more info/commands to the same page to advise how to do a safe update?

Thanks.

leiweibau commented 9 months ago

On the Settings -> Statusbox you can see, if a scan is currently running

Problem is, I don't know how to see if a scan is running or how to shut it down once one isn't?

status

There are actually 2 warnings 😉, but of course you know that. Immediately after the first warning, I stop all scans via pialert-cli and pause Pi.Alert for 10 minutes. Depending on the setting, a notification "should" appear. In the course of the update, a second warning then appears immediately before the database is updated. Pi.Alert is not terminated again here, as I do not assume that everything will take longer than 10 minutes. Afterwards, Pi.Alert is started again via pialert-cli, which also leads to another notification.

Maybe you could add a little more info/commands to the same page to advise how to do a safe update?

Thank you for pointing this out. I will revise/extend the warning in the update script.

I would also like to thank you for your many good suggestions and constructive comments in the past. Just before the Christmas season, it's time to say "thank you".

TheCableGuy99 commented 9 months ago

Firstly, I should be the one thanking you again.... you put all the work into this and if this was a docker container I couldn't run it because I don't have enough virtual switches for it to sit on al the vlans I have. I also think for the features and layout you have the best fork out there. So, thank you and for listening and all the time you put into it for us :)

I have some more suggestions for you though based on what you said above...

I actually never noticed the status section you pointed out before and I even had to look for it after it was just pointed out. The reason is because the section is collapsed and expandable by default. I was wondering if you can either make this open by default and remember your preferences for each section if you expand or collapse them? I presume it's something in the cookies that would do that? It's just each time I go back to there the sections are collapsed.

The other thing is just the status of the scan. Currently it says "0 scan(s) currently running". Can you change to say the same but add a countdown timer next to it when the next scan will start? As you might start and update when a scan starts, there's no indication when it will start and I think that's important.... the more info the better I say!,

Thanks again for all your consideration and efforts.

leiweibau commented 9 months ago

I actually never noticed the status section you pointed out ... reason is because the section is collapsed and expandable by default.

I collapsed the box as standard with the last update. I will undo this with the next update. I experimented with automatic collapsing (after 3 or 5 sec) in the beginning, but it always irritated me a bit.

The other thing is just the status of the scan. Currently it says "0 scan(s) currently running". Can you change to say the same but add a countdown timer next to it when the next scan will start?

I have added a countdown that indicates the start of a new scan. However, the text ("x scan(s) currently ...") is not yet updated in this context, as a running scan is recognized when the page is loaded. I can't yet say whether I will change this to JS. However, I have added a checkbox in the next update with which you can activate an automatic reload of the page every 2 minutes.

countdown menu
TheCableGuy99 commented 9 months ago

Brilliant, thank you as always, I look forward to the update :)

leiweibau commented 9 months ago

Update released with https://github.com/leiweibau/Pi.Alert/commit/3482459f357dca8a59fdcd487dc10aad3282ce2a

button on the page after checking for updates to update Pi.Alert if there is an update

I am not planing to do that ❌ We have already talked about this

Each time I update I have to come back here looking for the command

Show command on the update page ✅

Can you change to say the same but add a countdown timer next to it when the next scan will start?

Add Timer ✅

Maybe you could add a little more info/commands to the same page to advise how to do a safe update?

Update Help/FAQ. Add a hint to the FAQ in the warning ✅

The reason is because the section is collapsed and expandable by default.

Roll back collapsed status box ✅

I hope I haven't overlooked anything important and would be pleased if I can help you with one or two things.

Greetings

TheCableGuy99 commented 9 months ago

Hey,

This is awesome, all looks great... thank you.

I have 1 more idea regarding the updates....

Why not give the option for it to automatically check for updates every 6 hours, or however often the user wants. Then it emails a notification. It already has email capabilities so emails, so I presume it's not that difficult to send a notification.

Then stop any further emails on updates until an update is done so you don't get repeated emails about the update.

What do you think?

leiweibau commented 9 months ago

I've also thought about that before. That would be a task for the backend. Something like that will probably come along, but I can't say when yet.

TheCableGuy99 commented 9 months ago

I've thought about it and thought it might be pretty easy to setup....

Setup a cron job to check for updates every 4 hours and if there is send an email and remove the cron so not further checks are needed and no further emails are sent. Next updates checks if the cron is present and if not re-adds it.

Maybe if possible allow users to be able to edit the check frequency from the admin interface which alters the cron schedule?

Just a thought but I know you know way more than me haha

Cheers.

leiweibau commented 9 months ago

But that's a story for a future feature request 😉