release
This commit is contained in:
190
README.md
Normal file
190
README.md
Normal file
@@ -0,0 +1,190 @@
|
||||
# GPON Monitor
|
||||
|
||||
Real-time monitoring for ONT/ONU GPON devices via OMCI telnet and web scraping with RRD-based historical graphs.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Clone or download the project
|
||||
```bash
|
||||
git clone <repo-url>
|
||||
cd gpon-monitor
|
||||
```
|
||||
|
||||
### 2. Configure .env file
|
||||
```bash
|
||||
cp .env.example .env
|
||||
nano .env
|
||||
```
|
||||
|
||||
Edit basic parameters:
|
||||
```env
|
||||
GPON_HOST=192.168.100.1
|
||||
GPON_USERNAME=admin
|
||||
GPON_PASSWORD=admin
|
||||
EXTERNAL_PORT=8080
|
||||
```
|
||||
|
||||
### 3. Start the container
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 4. Open in browser
|
||||
```
|
||||
http://localhost:8080
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Real-time metrics: RX/TX optical power, temperature, uptime
|
||||
- Historical graphs: 1 hour to 5 years
|
||||
- Statistics: packets, bytes, FEC errors, data volume
|
||||
- Alerts: optical power threshold monitoring
|
||||
- Prometheus metrics endpoint
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
# Start
|
||||
docker-compose up -d
|
||||
|
||||
# Stop
|
||||
docker-compose down
|
||||
|
||||
# View logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Restart
|
||||
docker-compose restart
|
||||
|
||||
# Rebuild after code changes
|
||||
docker-compose build
|
||||
docker-compose up -d
|
||||
|
||||
# Remove everything including RRD data
|
||||
docker-compose down -v
|
||||
rm -rf data/rrd/*
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
leox-gpon-monitoring/
|
||||
├── .env # Configuration (HOST, PORT, credentials)
|
||||
├── docker-compose.yml
|
||||
├── Dockerfile
|
||||
├── data/rrd/ # RRD data files (persistent volume)
|
||||
└── ...
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Change web port
|
||||
```env
|
||||
EXTERNAL_PORT=80 # External web port (default: 8080)
|
||||
LISTEN_PORT=8080 # Internal port (usually no need to change)
|
||||
```
|
||||
|
||||
### Change polling interval
|
||||
```env
|
||||
POLL_INTERVAL=60 # Seconds (default: 60s)
|
||||
```
|
||||
|
||||
### Alert thresholds
|
||||
```env
|
||||
RX_POWER_MIN=-28.0
|
||||
RX_POWER_MAX=-8.0
|
||||
TX_POWER_MIN=0.5
|
||||
TX_POWER_MAX=4.0
|
||||
TEMPERATURE_MAX=85.0
|
||||
```
|
||||
|
||||
## Docker Details
|
||||
|
||||
- Base image: Python 3.11 Alpine
|
||||
- Volumes: `./data/rrd:/data/rrd`
|
||||
- Network: Bridge
|
||||
- Healthcheck: `/api/current` endpoint
|
||||
- Restart policy: unless-stopped
|
||||
|
||||
## API Endpoints
|
||||
|
||||
```bash
|
||||
# Current data
|
||||
curl http://localhost:8080/api/current
|
||||
|
||||
# Optical history (RX/TX power, temperature)
|
||||
curl http://localhost:8080/api/history/optical/24h
|
||||
|
||||
# Traffic history (packets, bytes)
|
||||
curl http://localhost:8080/api/history/traffic/7d
|
||||
|
||||
# FEC errors history
|
||||
curl http://localhost:8080/api/history/fec/1h
|
||||
|
||||
# Prometheus metrics
|
||||
curl http://localhost:8080/metrics
|
||||
```
|
||||
|
||||
Available periods: `1h`, `6h`, `12h`, `24h`, `3d`, `7d`, `14d`, `30d`, `60d`, `90d`, `120d`, `1y`, `2y`, `5y`
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### No connection to ONT
|
||||
```bash
|
||||
# Check logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Verify ONT is reachable
|
||||
ping 192.168.100.1
|
||||
|
||||
# Test telnet connection
|
||||
telnet 192.168.100.1 23
|
||||
```
|
||||
|
||||
### No data on graphs
|
||||
```bash
|
||||
# Check if RRD files are created
|
||||
ls -lah data/rrd/
|
||||
|
||||
# Wait 2-3 minutes for initial data collection
|
||||
```
|
||||
|
||||
### Reset all data
|
||||
```bash
|
||||
docker-compose down
|
||||
rm -rf data/rrd/*.rrd
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker
|
||||
- Docker Compose
|
||||
- ONT device with telnet access (port 23)
|
||||
|
||||
## Development
|
||||
|
||||
### Development mode with hot-reload
|
||||
```bash
|
||||
docker run -it --rm \
|
||||
-p 8080:8080 \
|
||||
-v $(pwd):/app \
|
||||
-v $(pwd)/data/rrd:/data/rrd \
|
||||
--env-file .env \
|
||||
gpon-monitor:latest
|
||||
```
|
||||
|
||||
### Manual build
|
||||
```bash
|
||||
docker build -t gpon-monitor:latest .
|
||||
docker run -d -p 8080:8080 --env-file .env gpon-monitor:latest
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
## Author
|
||||
|
||||
linuxiarz.pl Mateusz Gruszczyński
|
||||
Reference in New Issue
Block a user