Skip to content

0xfederama/connection-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 

Repository files navigation

Connection Analyzer

⏱️ ⏱️ ⏱️

Connection analyzer is a utility tool to monitor your internet connection. It's a simple Python script that does a speedtest every 8 hours and sends you an email with the latest values.

Emails are temporary disabled

Installation

To use the script you have to download it (and its dependencies) and give it permissions to execute.

$ pip install speedtest-cli==2.1.2
$ git clone https://github.com/0xfederama/connection-analyzer.git
$ cd connection-analyzer
$ chmod +x script.py

Now you can launch the script with python3 script.py. man If you want to execute the script every time you turn on your computer (or your raspberrypi) you have to add python3 /absolute/path/to/script.py & at the end of the file /etc/rc.local, just before the line that has exit 0, and reboot.

Customization

You can customize the script as you want. The first thing that you can customize is the email (line 4-5): if you don't want to receive an email leave the field blank as it is, otherwise write your own email and password. If you don't want to receive emails, only change this field. Emails are temporary disabled

You can customize also the value of the hours (line 6). With a default value of 6, you will receive an email every 6 hours. After 8 hours, the dictionary will be reset to default values, in order to check if, in a 6-hour span, the connection has had problems (otherwise, the average in a long span of hours will flatten the curve).

Since the json file is never read by the program, if you change the values of the json it doesn't affect the program.

How to check internet speed values

When you want to check the latest values of your internet speed, you can view the json file stored in ~/.config/connection-analyzer. That file will be overwritten the next time that your internet speed is tested (in 15 minutes).

If you want to save a file, you can just change the name of the json file that you don't want to be overwritten. Anyway, if your connection speed drops by 75%, the script will automatically save a new json with the date of the issue in the same directory.

Json example

{
    "email": "",
    "hours": 6,
    "last_hours": {
        "date": "2021-04-02 @ 13:15",
        "network-name": "Wi-Fi",
        "avg_download": 46.77,
        "avg_upload": 19.86,
        "avg_ping": 22.56,
        "min_download": 42.1,
        "max_download": 53.47,
        "min_upload": 18.23,
        "max_upload": 22.01,
        "min_ping": 16.38,
        "max_ping": 26.98
    }
}

Releases

No releases published

Packages

No packages published

Languages