A network monitoring tool with ping tracking and dashboard visualization
Project description
Network Check Tool
A comprehensive network monitoring tool that performs periodic ping tests to monitor host availability and response times, with a web-based dashboard for visualization.
๐ Quick Start
Installation from PyPI (Recommended)
Install the package directly from PyPI:
pip install network-check-tool
Installation from Source
If you want to contribute or modify the code:
# Clone the repository
git clone https://github.com/hardwork9047/network-check-tool.git
cd network-check-tool
# Install with Poetry (recommended for development)
poetry install
# Or install with pip
pip install -e .
First Steps
- Initialize the database:
network-checker init
- Test a single host:
network-checker ping google.com
- Start the web dashboard:
network-checker run-server
Then open http://localhost:9991 in your browser.
๐ What is Network Check Tool?
Network Check Tool is a Python application designed for continuous network monitoring. It helps you:
- Monitor network connectivity to multiple hosts simultaneously
- Track response times and packet loss over time
- Visualize network performance through an interactive web dashboard
- Set up automated monitoring with customizable intervals
- Access historical data through CLI commands or REST API
Perfect for system administrators, DevOps engineers, and anyone who needs to monitor network reliability.
โจ Features
๐ฏ Core Functionality
- Periodic Ping Monitoring: Automated ping tests at configurable intervals
- SQLite Database: Persistent storage of ping results with timestamps
- Web Dashboard: Interactive visualization using Plotly charts
- CLI Interface: Comprehensive command-line tools for management
- RESTful API: JSON endpoints for data access and integration
๐ Dashboard Features
- Real-time response time charts
- Packet loss visualization
- Success rate statistics
- Multiple host monitoring
- Time range filtering (1 hour to 1 week)
- Auto-refresh every 30 seconds
โก Advanced Features
- Background scheduling with APScheduler
- Configurable ping timeouts and intervals
- Database indexing for performance
- Error handling and logging
- Development and production configurations
๐ ๏ธ Usage Examples
Basic Monitoring
# Monitor a single host
network-checker ping google.com --count 5
# Start continuous monitoring of multiple hosts
network-checker start-monitoring google.com cloudflare.com 8.8.8.8 --interval 30
# Check recent results
network-checker status --host google.com --limit 10
Web Dashboard
# Start the web server (default: http://localhost:9991)
network-checker run-server
# Run on different host/port
network-checker run-server --host 0.0.0.0 --port 8080
Data Management
# View all monitored hosts
network-checker status
# Clear all data (with confirmation)
network-checker clear
๐ CLI Commands Reference
| Command | Description | Example |
|---|---|---|
network-checker ping <host> |
Send ping tests to a specific host | network-checker ping example.com --count 4 |
network-checker start-monitoring <hosts> |
Start continuous monitoring | network-checker start-monitoring google.com --interval 60 |
network-checker run-server |
Start the web dashboard server | network-checker run-server --port 9991 |
network-checker status |
Display recent ping results | network-checker status --host google.com |
network-checker init |
Initialize the database | network-checker init |
network-checker clear |
Clear all ping data | network-checker clear |
๐ Web Dashboard
After starting the server with network-checker run-server, access the dashboard at http://localhost:9991.
Dashboard Features
- Host Selection: Choose from monitored hosts
- Time Range: View data from 1 hour to 1 week
- Statistics Cards: Total pings, success rate, average response time, packet loss rate
- Interactive Charts: Response time trends with packet loss indicators
- Auto-refresh: Updates every 30 seconds
๐ API Endpoints
The tool provides a REST API for integration with other tools:
GET /api/hosts
Get list of monitored hosts
curl http://localhost:9991/api/hosts
# Returns: ["google.com", "cloudflare.com"]
GET /api/stats?host=<host>&hours=<hours>
Get statistics for a specific host
curl "http://localhost:9991/api/stats?host=google.com&hours=24"
GET /api/ping_data?host=<host>&hours=<hours>
Get raw ping data for visualization
curl "http://localhost:9991/api/ping_data?host=google.com&hours=1"
โ๏ธ Configuration
Environment Variables
Customize behavior with environment variables:
# Database configuration
DATABASE_URL=sqlite:///network_check_tool.db
# Ping settings
PING_TIMEOUT=4.0
DEFAULT_PING_INTERVAL=60
# Default hosts to monitor
DEFAULT_HOSTS=google.com,cloudflare.com
# Flask configuration
SECRET_KEY=your-secret-key
Configuration Profiles
The application supports different configuration profiles:
- Development: Debug mode enabled, SQL logging
- Production: Optimized for production deployment
๐๏ธ Project Structure
network_check_tool/
โโโ __init__.py # Package initialization
โโโ app.py # Flask application factory
โโโ cli.py # Command-line interface
โโโ models/
โ โโโ __init__.py
โ โโโ ping_result.py # SQLAlchemy model
โโโ services/
โ โโโ __init__.py
โ โโโ ping_service.py # Ping execution service
โ โโโ scheduler_service.py # Background scheduling
โโโ views/
โ โโโ __init__.py
โ โโโ dashboard.py # Web API endpoints
โโโ templates/
โ โโโ dashboard.html # Web dashboard UI
โโโ config/
โโโ __init__.py
โโโ config.py # Application configuration
๐ Database Schema
ping_results table
id: Primary key (INTEGER)target_host: Target hostname (VARCHAR(255), indexed)timestamp: Ping timestamp (DATETIME, indexed)response_time: Response time in milliseconds (FLOAT, nullable)packet_loss: Boolean indicating packet loss (BOOLEAN)error_message: Error details if ping failed (TEXT, nullable)
๐ง Development
Development Setup
# Clone the repository
git clone https://github.com/hardwork9047/network-check-tool.git
cd network-check-tool
# Install with Poetry (recommended)
poetry install
# Or create a virtual environment and install with pip
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
Running Tests
poetry run pytest
# or
python -m pytest
Code Formatting
poetry run black network_check_tool/
# or
black network_check_tool/
Development Server
# Run with auto-reload for development
poetry run network-checker run-server --debug
๐ Production Deployment
With Docker (Recommended)
# Dockerfile example
FROM python:3.10-slim
WORKDIR /app
COPY . .
RUN pip install network-check-tool
EXPOSE 9991
CMD ["network-checker", "run-server", "--host", "0.0.0.0", "--port", "9991"]
docker build -t network-check-tool .
docker run -p 9991:9991 network-check-tool
Manual Deployment
# Install the package
pip install network-check-tool
# Initialize database
network-checker init
# Run with a production WSGI server
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:9991 "network_check_tool.app:create_app('production')"
๐ฆ Dependencies
Runtime Dependencies:
flask- Web frameworkflask-sqlalchemy- Database ORMping3- Ping functionalityapscheduler- Background schedulingplotly- Data visualizationpandas- Data manipulationflask-cors- CORS supportclick- CLI frameworktoml- Configuration parsing
Development Dependencies:
pytest- Testing frameworkblack- Code formatting
๐ค Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pytest) - Format code (
black .) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- ๐ Documentation
- ๐ Issue Tracker
- ๐ฌ Discussions
๐ Why Network Check Tool?
- Easy to Use: Simple CLI commands and intuitive web interface
- Lightweight: Minimal resource usage with SQLite database
- Flexible: Configurable monitoring intervals and multiple output formats
- Reliable: Robust error handling and comprehensive logging
- Open Source: MIT licensed and community-driven
Network Check Tool - Keep your network monitoring simple and effective! ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file network_check_tool-0.0.2.tar.gz.
File metadata
- Download URL: network_check_tool-0.0.2.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8f8eccfad7d943acacff6e87bbd57d90e6fd87b8252ca8a83252f60def54d28
|
|
| MD5 |
4f5d3f6f0ef73a23ba07ddd3b8e2a1e3
|
|
| BLAKE2b-256 |
ef5a9170ec0ac2f9124a3b32abf815b41fdb1ad609ebbe1ed676ff581afd1c3f
|
File details
Details for the file network_check_tool-0.0.2-py3-none-any.whl.
File metadata
- Download URL: network_check_tool-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/24.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c065f896cdbdb0872c9efeec8f112797b3b50f58e6f9f393e6307b6bd666891e
|
|
| MD5 |
a08986eca6b8202a029d6ac823d2d757
|
|
| BLAKE2b-256 |
d949aa8d0da53ca736037bb2a0825f57c223e2dff9fcd82b7f1eb8f008d260cc
|