Makefile to make it easy to build the apps. Better readme files for the whole repo, moved ping_service readme to new name.

This commit is contained in:
Kalzu Rekku
2026-01-08 12:32:38 +02:00
parent 6db2e58dcd
commit c663ec0431
3 changed files with 411 additions and 37 deletions

57
ping_service_README.md Normal file
View 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`