v0.0.3 - To be come a daemon.
This commit is contained in:
57
README.md
Normal file
57
README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Ping Service
|
||||
|
||||
A Go-based monitoring service that periodically pings IP addresses from a configurable input source (file, HTTP, or Unix socket), applies cooldown periods to avoid frequent pings, optionally performs traceroute on successes, and outputs JSON results to a destination (file, HTTP, or socket). Includes health checks and metrics.
|
||||
|
||||
## Features
|
||||
- Reads IPs from file, HTTP endpoint, or Unix socket.
|
||||
- Configurable ping interval and per-IP cooldown.
|
||||
- Optional traceroute (ICMP/TCP) with max hops.
|
||||
- JSON output with ping stats and traceroute details.
|
||||
- HTTP health endpoints: `/health`, `/ready`, `/metrics`.
|
||||
- Graceful shutdown and verbose logging support.
|
||||
|
||||
## Configuration
|
||||
Edit `config.yaml`:
|
||||
```yaml
|
||||
input_file: "http://localhost:8080" # Or file path or socket
|
||||
output_file: "http://localhost:8081" # Or file path or socket
|
||||
interval_seconds: 30 # Poll interval
|
||||
cooldown_minutes: 10 # Min time between same-IP pings
|
||||
enable_traceroute: true # Enable traceroute
|
||||
traceroute_max_hops: 30 # Max TTL
|
||||
health_check_port: 8090 # Health server port
|
||||
```
|
||||
|
||||
## Building
|
||||
```bash
|
||||
go build -o ping_service
|
||||
```
|
||||
|
||||
## Installation as Service (Linux)
|
||||
```bash
|
||||
chmod +x install.sh
|
||||
sudo ./install.sh
|
||||
sudo systemctl start ping-service
|
||||
```
|
||||
|
||||
- Check status: `sudo systemctl status ping-service`
|
||||
- View logs: `sudo journalctl -u ping-service -f`
|
||||
- Stop: `sudo systemctl stop ping-service`
|
||||
|
||||
## Usage
|
||||
Run directly:
|
||||
```bash
|
||||
./ping_service -config config.yaml -verbose
|
||||
```
|
||||
|
||||
For testing HTTP I/O:
|
||||
- Run `python3 input_http_server.py` (serves IPs on port 8080).
|
||||
- Run `python3 output_http_server.py` (receives results on port 8081).
|
||||
|
||||
## Health Checks
|
||||
- `curl http://localhost:8090/health` (status, uptime, stats)
|
||||
- `curl http://localhost:8090/ready` (readiness)
|
||||
- `curl http://localhost:8090/metrics` (Prometheus metrics)
|
||||
|
||||
Version: 0.0.3
|
||||
Dependencies: `go-ping/ping`, `gopkg.in/yaml.v
|
||||
Reference in New Issue
Block a user