A lightweight, zero-dependency Python script designed to continuously monitor your internet connection, record downtimes with exact timestamps, and calculate total outage durations.
This tool was created out of frustration with persistent neighborhood internet drops. Whenever residents called our ISP (AT&T), support claimed there were no active outages in the area and suggested basic support actions like router reboots, even suggesting router upgrades.
By running this script 24/7 on a local machine, I gathered two months of precise outage timestamps and compared the data with outage complaints on our neighborhood forum. When the outages were cross referenced with posts from multiple neighbors, I presented the combined evidence to the ISP.
The Result:
- The ISP escalated the issue and discovered a faulty card in the local central switch servicing our neighborhood.
- Hardware was replaced, reducing neighborhood outages to zero major drops over 6+ months.
- Multiple affected neighbors received account statement credits.
If your ISP denies recurring connection issues, this script provides the raw data you need to prove it.
- Zero External Dependencies: Built entirely with standard Python library modules (
socket,time,datetime). - Low Overhead: Runs continuously with negligible CPU and memory usage.
- Automatic Downtime Tracking: Detects when the connection drops, logs the failure, and records total duration once restored.
- Persistent Logging: Writes all downtime events to a plain-text log file (
internet_outages.txt).
- Python 3.x installed on your system.
- A computer that stays powered on 24/7 (Windows, macOS, Linux, or a Raspberry Pi).
- Clone the repository:
git clone https://github.com/OriginDevIT/internet-outage-monitor.git cd internet-outage-monitor - Run the script:
python monitor.py
You can customize the monitoring parameters directly in monitor.py:
CHECK_INTERVAL = 300 # Time between checks in seconds (default: 5 minutes)
LOG_FILE = "internet_outages.txt" # Name of the output log file
REMOTE_SERVER = "8.8.8.8" # Server to check against (default: Google DNS)The script creates and updates internet_outages.txt whenever a status change occurs:
2026-08-01 14:10:05 - INTERNET DOWN
2026-08-01 14:25:12 - INTERNET RESTORED. Total downtime: 0:15:07
To keep the script running automatically on Windows without keeping a command prompt window visible:
- Option A (Task Scheduler): Create a task in Windows Task Scheduler set to run at system startup using
pythonw.exe monitor.py. - Option B (Batch Startup): Place a shortcut to your script in the Windows Startup folder (
shell:startup).
Distributed under the MIT License. See LICENSE for more information.