I have been having quite a lot of trouble with my T-Mobile business internet. I would like to set up a pi so that when it loses internet it sends an email, and another when internet is restored (I realize without net the outage email will not actually send, but if there is a time stamp I can at least present it to T-Mobile and say look this is a serious issue when my net is down more than it is up), and run an hourly speed test and email the results. For a novice is something like this feasible?
Perhaps it would be better to continously monitor the situation and send an email with start / stop time in one go.
Still, shouldn’t be hard: Script that runs in a loop, that checks internet connectivity by connecting to a reliable source, eg. some major cloud provider’s service If the service call times out, catch the error and record the time and enter a 2nd loop, which tries to send a message with the start time of the error and the time the loop ran.
Remember to put some sleep in the loops so that they run every few minutes or so.
I would also suggest something like a telegram or slack message. Modern email servers can be cantankerous about random scripts sending email.
You can build this with basically anything: Node red, python, ruby, shell scripts or home assistant would be my choices.
You might want to also set up some kind of monitoring in case the script goes down, many ways to do this, simplest one being a shell script which restarts a nested script or something like monit or systemd.