A lightweight network monitoring tool that periodically runs ICMP ping tests and logs the results to Logida for centralized logging and analysis.
- 🏓 Automated ping tests every 10 minutes
- 📊 Centralized logging via Logida API
- 🛑 Graceful shutdown with Ctrl+C
- ⚙️ Configurable ping parameters (count, interval, target)
- 🔒 Secure API key management via environment variables
- Go 1.16 or higher
- A Logida account and API key
- Clone the repository:
git clone <your-repo-url>
cd network_testing- Install dependencies:
go mod download- Create a
.envfile in the project root:
LOGIDA_API_KEY=your_api_key_hereGet your API key by creating an account at https://logida.fly.dev/
go run main.goDefault configuration:
- Target: www.google.com
- Count: 100 packets
- Interval: 1 second between packets
- Test frequency: Every 10 minutes
To use custom ping settings, modify the PingTestConfig in main.go:
config := internal.PingTestConfig{
Count: 50, // Send 50 packets
Interval: 2 * time.Second, // 2 seconds between packets
Target: "8.8.8.8", // Ping Google DNS
}
internal.RunTest(config)Build the executable:
go build -o NETWORK_TESTING/cmdRun the binary:
./NETWORK_TESTING/cmdnetwork_testing/
├── cmd
│ └── main.go # Application entry point
├── internal/
│ ├── PingTestConfig.go # Configuration structure with default method / option
│ ├── SendLog.go # Sends report to Logida
│ └── RunTest.go # Ping test implementation
├── .env # Environment variables (not committed)
├── go.mod # Go module definition
└── README.md
- Startup: Loads environment variables and validates Logida API key
- Initial Test: Runs an immediate ping test on startup
- Periodic Tests: Executes ping tests every 10 minutes
- Logging: Sends results to Logida API for centralized monitoring
- Shutdown: Gracefully handles interrupt signals (Ctrl+C, SIGTERM)
- pro-bing - ICMP ping library
- godotenv - Environment variable management
- Logida - Logging and analytics platform
- Ensure your
.envfile exists in the project root - Verify the API key is correctly formatted
- Check file permissions on
.env
- Check your internet connection
- Verify the target host is reachable
- Review Logida dashboard for error logs
Contributions are welcome! Please feel free to submit a Pull Request.
MIT