4

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?

top 3 comments
sorted by: hot top controversial new old
[-] new_guy@lemmy.world 4 points 1 year ago

It is possible although I'm not sure if I were in your shoes I'd choose this path.

I'd recommend setting up a cron job to ping at Google (for example) every X minutes and dumping the results to a file for later.

For something more like what you're actually trying to do maybe take a look at "uptime-kuma" on GitHub. It seems to fit your needs well.

[-] wizzor@sopuli.xyz 2 points 1 year ago

Yea this is a better idea than what I outlined below, unless you are seeking to learn how to do this sort of thing from scratch.

Good way to learn, but not a great idea if you want to get it working fast...

[-] wizzor@sopuli.xyz 3 points 1 year ago

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.

this post was submitted on 27 Oct 2023
4 points (100.0% liked)

Single Board Computers

1271 readers
1 users here now

A community for the discussion of all single board computers. Raspberry Pi is ok, but there are so many other boards now that get looked over that deserve attention.

Post news, questions, your setups, guides, anything that has to do with SBCs. Server wide rules apply

founded 1 year ago
MODERATORS