A comprehensive cross-platform network monitoring tool that continuously tracks internet connectivity, diagnoses outages, and identifies whether problems originate from your local network, ISP, or external services. Works on Windows, Linux, and macOS. Perfect for documenting ISP reliability issues with detailed evidence.
π‘ Best Practice: This tool is designed for continuous monitoring and works best on an always-on device like a home server, Raspberry Pi, NAS, or dedicated monitoring PC. For laptops/desktops that sleep or shut down, monitoring gaps will occur.
- π₯οΈ Graphical User Interface: Easy-to-use GUI with real-time monitoring dashboard (NEW in v3.1!)
- π Home Assistant Integration: Full integration as custom component with sensors and automations (NEW in v3.1!)
- π Live Status Display: Monitor gateway, internet, and statistics in real-time
- π One-Click Controls: Start/Stop monitoring, run tests, view logs - all from GUI
- π Integrated Log Viewer: Browse and search MTR logs with syntax highlighting
- π Context Menus: Right-click to copy selected text from logs and activity
- βοΈ GUI Configuration: Edit settings and setup scheduler without touching terminal
- π¦ Standalone Executables: Optional .exe/.app builds - no Python installation needed!
- Cross-Platform Support: Works on Windows, Linux, and macOS with automatic OS detection
- Multi-Layer Connectivity Testing: ICMP (ping), TCP, HTTP, and DNS validation
- ISP Hop Monitoring: Track your ISP's network hops to detect upstream issues
- Automatic Root Cause Analysis: Distinguishes between LAN, WAN, DNS, and transport layer problems
- Continuous MTR Logging: Records traceroute data during outages and periodic baselines (with Windows fallback)
- Automated Scheduling: Easy setup scripts for Task Scheduler, cron, and launchd
- Flexible Timing: Configure to run every minute, specific hours, weekdays only, etc.
- Detailed Analysis Reports: Automated outage summaries with statistics
- ISP Discovery Tool: Automatically identify your ISP's network hops
- Graphical Interface (GUI)
- Home Assistant Integration
- Installation
- Quick Start
- Configuration
- Usage
- Understanding the Output
- Advanced Features
- Building Executables
- Troubleshooting
- Contributing
- License
For users who prefer a graphical interface, we now offer a full-featured GUI application!
From Python (source):
# Activate venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windows
# Run GUI
python network_logging_gui.py
From Executable (no Python needed):
- Windows: Double-click
NetworkLoggingMonitor.exe
- Linux: Run
./NetworkLoggingMonitor
- macOS: Open
NetworkLoggingMonitor.app
- π Real-Time Dashboard: Live status of gateway, internet connectivity, and statistics
βΆοΈ Start/Stop Monitoring: One-click continuous monitoring- π Session Statistics: Success rate, uptime, total checks
- π Activity Log: Real-time feed of all monitoring events
- π Log Viewer: Browse and search MTR logs with syntax highlighting
- π¬ Manual Tests: Run on-demand diagnostics
- π Quick Access: Open logs folder, edit config, analyze results
- β° Scheduler Setup: Configure automated monitoring with admin rights (GUI prompts)
- π ISP Discovery: Find optimal monitoring targets
- π TCP Probing: Test firewall and port connectivity
- π Context Menus: Right-click to copy selected text from any log window
See GUI_USAGE.md for complete documentation with screenshots.
Want to distribute the GUI as a single .exe/.app file?
# Install PyInstaller
pip install pyinstaller
# Windows
build_windows.bat
# Linux
./build_linux.sh
# macOS
./build_macos.sh
See BUILD.md for detailed build instructions.
We now provide a native Home Assistant custom integration for seamless network monitoring!
- β Binary Sensors: Gateway reachable, Internet connected, Per-target status
- β Statistics Sensors: Gateway IP, Average latency, Success rate
- β Services: Manual tests, Gateway checks
- β Automations: Create alerts for network issues
- β Lovelace Cards: Beautiful dashboard widgets
- β No External Dependencies: Pure Python, uses built-in tools
Via HACS (Recommended):
- Add custom repository:
https://github.com/yourusername/network-logging
- Download "Network Monitoring" integration
- Restart Home Assistant
- Add to
configuration.yaml
:network_logging: scan_interval: 300 targets: - "1.1.1.1" - "8.8.8.8"
- Restart Home Assistant again
Manual Installation:
- Copy
custom_components/network_logging/
to/config/custom_components/
- Restart Home Assistant
- Configure (see above)
- Restart again
automation:
- alias: "Internet Down Alert"
trigger:
- platform: state
entity_id: binary_sensor.network_internet_connected
to: "off"
for: "00:02:00"
action:
- service: notify.mobile_app
data:
title: "β οΈ Network Alert"
message: "Internet connection lost!"
See custom_components/network_logging/README.md for complete Home Assistant documentation.
See BUILD.md for detailed compilation instructions.
Result: Single ~25-35 MB executable with no Python installation required!
Integrate with Home Assistant for smart home automation and monitoring!
-
Copy integration:
cp -r custom_components/network_logging /config/custom_components/
-
Add to configuration.yaml:
network_logging: project_path: "/path/to/network-logging" scan_interval: 60 targets: - "1.1.1.1" - "8.8.8.8"
-
Restart Home Assistant
Binary Sensors:
binary_sensor.network_gateway
- Gateway connectivitybinary_sensor.internet_connection
- Internet status- Per-target sensors (e.g.,
binary_sensor.internet_1_1_1_1
)
Sensors:
sensor.gateway_ip
- Gateway IP addresssensor.success_rate_today
- Success percentagesensor.average_latency
- Latency in mssensor.packet_loss
- Packet loss percentage
Services:
network_logging.run_test
- Manual diagnosticnetwork_logging.analyze_logs
- Log analysis
automation:
- alias: "Internet Down Alert"
trigger:
platform: state
entity_id: binary_sensor.internet_connection
from: "on"
to: "off"
action:
service: notify.notify
data:
title: "π Internet Outage"
message: "Internet connection lost!"
See custom_components/network_logging/README.md and INSTALLATION.md for complete Home Assistant documentation.
- Python 3.8 or higher
- Windows 10/11, Linux, or macOS
mtr
(My Traceroute) - recommended for best results (optional on Windows, uses pathping fallback)- Admin/sudo access for some network operations (especially on Windows)
- Recommended: Always-on device (server, Raspberry Pi, NAS) for continuous monitoring
Debian/Ubuntu:
sudo apt update
sudo apt install mtr-tiny python3 python3-venv python3-tk # python3-tk fΓΌr GUI!
Fedora/RHEL/CentOS:
sudo dnf install mtr python3 python3-tkinter # python3-tkinter fΓΌr GUI!
macOS:
brew install mtr
Windows:
# MTR for Windows (optional, uses pathping as fallback)
# Download from: https://github.com/traviscross/mtr/releases
# Or use Chocolatey:
choco install mtr
-
Clone or download this repository:
# Linux/macOS git clone https://github.com/yourusername/network-logging.git cd network-logging
# Windows (PowerShell) git clone https://github.com/yourusername/network-logging.git cd network-logging
-
Create a virtual environment (recommended):
β οΈ Important: Always run this project in a virtual environment to avoid conflicts with system Python packages.# Linux/macOS python3 -m venv venv source venv/bin/activate
# Windows (PowerShell) python -m venv venv .\venv\Scripts\Activate.ps1
-
Install Python dependencies:
pip install -r requirements.txt
(Note: This project uses only Python standard library, so requirements.txt is minimal)
-
Create your configuration file:
# Linux/macOS cp config.example.json config.json
# Windows copy config.example.json config.json
-
Discover your ISP hops (recommended):
python discover_isp_hops.py
This will suggest ISP hop IPs to add to your
config.json
.
Single monitoring cycle:
python netLogging.py
This will:
- Test connectivity to your gateway and configured targets
- Log results to
logs/netlog.csv
- Create detailed MTR logs if issues are detected
- Append to continuous per-target log files (no file spam!)
For continuous monitoring, use the automated setup scripts:
π‘ Tip: These scripts are designed for always-on devices. If your device sleeps or shuts down, monitoring will stop. Consider using a Raspberry Pi, home server, or NAS for 24/7 monitoring.
Windows (Task Scheduler):
# Run PowerShell as Administrator
.\setup_windows_scheduler.ps1
# Follow prompts to select interval
Linux (cron):
./setup_linux_cron.sh
# Follow prompts to select interval
macOS (launchd):
./setup_macos_launchd.sh
# Follow prompts to select interval
See SCHEDULING.md for:
- Detailed setup instructions
- Custom time schedules (business hours only, weekdays, etc.)
- Advanced configuration
- Troubleshooting
After collecting data:
python analyze_netlog.py
This generates a comprehensive report including:
- Outage timeline and statistics
- Availability percentages
- Gateway latency analysis
- Root cause breakdown
- Hourly distribution
Edit config.json
to customize monitoring behavior. See config.example.json
for detailed documentation.
Setting | Description | Default |
---|---|---|
gateway |
Your router IP or "auto" |
"192.168.1.1" |
targets |
Public IPs to test (e.g., DNS servers) | ["1.1.1.1", "8.8.8.8"] |
log_dir |
Where to store logs | "./logs" |
ping_interval_sec |
Seconds between tests (for loop mode) | 20 |
Setting | Description | Recommendation |
---|---|---|
isp_targets |
ISP hop IPs to monitor | Keep to 1-2 IPs max! Use discover_isp_hops.py |
mtr_baseline_enabled |
Periodic MTR even when OK | true |
mtr_baseline_period_sec |
Seconds between baseline MTR | 900 (15 min) |
Setting | Description | Default |
---|---|---|
mtr_intensive_enabled |
Run detailed MTR during outages | true |
mtr_intensive_count |
Packets per MTR run | 60 |
analyze_on_outage |
Auto-run analysis on outage | true |
dns_test_hostname |
Hostname for DNS tests | "example.com" |
CSV columns include:
- local_timestamp / utc_timestamp: When the test ran
- gateway_ms: Latency to your router (ms)
- targets_reachable: Fraction of targets responding (e.g., "3/4")
- dns_ok / http_dns_ok / http_ip_ok / tcp443_ok: Layer-specific test results (1=pass, 0=fail)
- overall_status:
OK
,LAN_DOWN
,WAN_DOWN
,DNS_APP_FAIL
,APP_LAYER_FAIL
- root_cause_hint:
DNS
,ICMP-only
,Transport
,Mixed
- isp_reachable / isp_detail: ISP hop status
New: Consolidated format! Instead of creating hundreds of files, each target gets ONE continuous log file:
logs/mtr_1_1_1_1.log
- All MTR runs to 1.1.1.1logs/mtr_88_79_29_66.log
- All MTR runs to ISP hop
Each run is separated by timestamp headers:
============================================================
Run at: 20251002_143502
============================================================
Start: 2025-10-02T14:35:02+0200
HOST: your-server Loss% Snt Last Avg Best Wrst StDev
1. AS??? 192.168.1.1 0.0% 60 0.6 0.6 0.5 0.9 0.1
2. AS??? ??? 100.0 60 0.0 0.0 0.0 0.0 0.0
3. AS3209 88.79.29.66 0.0% 60 13.8 13.9 13.6 14.4 0.2
...
Run python analyze_netlog.py
to get:
=== Network Outage Analysis ===
Analysis period: 2025-10-01 22:36:08 to 2025-10-02 23:40:17
Total test cycles: 1,234
Total outages detected: 5
Overall availability: 99.18%
OK cycles: 1,224 (99.18%)
Outage cycles: 10 (0.82%)
Outage breakdown by root cause:
DNS: 2 (0.16%)
Transport: 3 (0.24%)
ICMP-only: 5 (0.41%)
Gateway statistics:
Average latency: 0.65 ms
Min: 0.50 ms | Max: 2.30 ms
...
Find the best ISP hops to monitor:
python discover_isp_hops.py
This runs multiple traceroutes and suggests stable IPs in hops 2-5 (your ISP's network). Add these to isp_targets
in config.json.
Important: Keep isp_targets
to 1-2 IPs maximum to avoid log file explosion!
Test TCP connectivity to multiple hosts:
# From config.json isp_targets + targets
python probe_tcp_hosts.py --from-config
# Custom hosts
python probe_tcp_hosts.py --hosts "1.1.1.1,8.8.8.8,9.9.9.9"
# From ISP discovery candidates
python probe_tcp_hosts.py --from-candidates
Outputs:
- Console summary
logs/tcp_probe_<timestamp>.json
with detailed results
Analyze specific time periods:
python analyze_netlog.py --csv logs/netlog.csv --log-dir logs
Use a different log location:
{
"log_dir": "/var/log/network-monitoring"
}
The script will attempt to create this directory or fall back to ./logs
.
Solution: Set gateway manually in config.json:
{
"gateway": "192.168.1.1"
}
Windows users: The script tries route print
to detect gateway. If this fails, set manually.
Solution: Install mtr (or use built-in fallbacks):
Linux:
# Debian/Ubuntu
sudo apt install mtr-tiny
# RHEL/Fedora
sudo dnf install mtr
macOS:
brew install mtr
Windows:
- Download from: https://github.com/traviscross/mtr/releases
- Or the script will automatically use
pathping
as fallback (slower but works)
Linux/macOS: Some operations require elevated privileges:
sudo python netLogging.py
Or configure capabilities (Linux):
sudo setcap cap_net_raw+ep $(which mtr)
Windows: Run PowerShell or Command Prompt as Administrator
Solutions:
- Increase
ping_interval_sec
in config.json (default: 20) - Reduce
mtr_intensive_count
(default: 60) - Disable baseline MTR: set
mtr_baseline_enabled
tofalse
- Reduce
isp_targets
to just 1 IP
Windows:
- Verify Task Scheduler service is running
- Check task history for errors
- Ensure paths in .bat file are absolute paths
Linux:
- Check cron service:
systemctl status cron
- View cron logs:
grep CRON /var/log/syslog
macOS:
- Check plist syntax:
plutil -lint ~/Library/LaunchAgents/com.networklogging.monitor.plist
- View launchd errors:
launchctl list | grep networklogging
Documenting ISP Issues:
Ideal Setup: Run on a Raspberry Pi, home server, NAS (Synology, QNAP), or old PC that stays on 24/7.
-
Set up monitoring:
python discover_isp_hops.py # Find your ISP hops # Edit config.json with suggested ISP targets crontab -e # Add cron job (Linux) or use setup scripts
-
Let it run for days/weeks - it logs automatically
-
When you experience issues:
python analyze_netlog.py > outage_report_$(date +%Y%m%d).txt
-
Submit evidence to ISP with:
outage_report_*.txt
- Summary statisticslogs/netlog.csv
- Complete timelinelogs/mtr_*.log
- Network path analysis during outageslogs/wan_diag_*.log
- System diagnostics
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
git clone https://github.com/yourusername/network-logging.git
cd network-logging
python3 -m venv venv
source venv/bin/activate
# Make changes and test
python netLogging.py
This project is licensed under the MIT License - see the LICENSE file for details.
- Uses mtr for network path analysis
- Inspired by the need to document ISP reliability issues
- Built with Python standard library only
Conrad Heilmann - Project Maintainer
GitHub: @yourusername
Star this repository if it helped you document your ISP's outages! β