Update CLAUDE.md with current state

- Correct web UI port (8088 not 8080 in Docker)
- Add ZABBIX_API_TOKEN to config table
- Document hostname format (yodeck- not yodeck#)
- Document visible name format (QRS- prefix)
- Add Zabbix 7.x setup requirements (group permissions, admin role)
- Document Bearer token auth approach

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 10:27:11 +02:00
parent 5db8beb847
commit 1c95f9a097

View File

@@ -20,14 +20,14 @@ python snmp_test.py --filter <name_or_id>
## Running in Docker
```bash
docker compose up -d # SNMP on :161/udp, web UI on :8080
docker compose up -d --build # SNMP on :161/udp, web UI on :8088
```
Before starting, set `APP_HOST` in `docker-compose.yml` to the host IP reachable by Zabbix, and optionally fill in `ZABBIX_URL` / `ZABBIX_PASSWORD`.
Edit `docker-compose.yml` before first run: set `APP_HOST` to the IP of the Docker host reachable by Zabbix.
## Configuration
All settings come from environment variables (see `app/config.py`). Key ones:
All settings are environment variables (see `app/config.py`). Key ones:
| Variable | Default | Purpose |
|---|---|---|
@@ -36,6 +36,8 @@ All settings come from environment variables (see `app/config.py`). Key ones:
| `ENTERPRISE_OID` | `.1.3.6.1.4.1.99999` | Root OID for all player data |
| `SNMP_COMMUNITY` | `public` | SNMPv2c community string |
| `ZABBIX_URL` | `""` | Leave empty to disable Zabbix auto-sync |
| `ZABBIX_API_TOKEN` | `""` | Preferred auth (Zabbix 5.4+, required for 6.4+) |
| `ZABBIX_USER` / `ZABBIX_PASSWORD` | — | Fallback auth when no API token |
| `DB_PATH` | `/data/yodmon.db` | SQLite file path |
## Architecture
@@ -61,7 +63,7 @@ Web UI
- col 5 `INTEGER` updating (0/1)
- col 6 `INTEGER` registered (0/1)
The Yodeck ID is used directly as the SNMP table index, so OIDs are stable and predictable (e.g. `.1.3.6.1.4.1.99999.1.1.3.54239` = online status of player 54239).
The Yodeck ID is used directly as the SNMP table index OIDs are stable (e.g. `.1.3.6.1.4.1.99999.1.1.3.54239` = online status of player 54239).
**Database** — two tables in `yodmon.db`:
- `players` — one row per Yodeck player, upserted on each poll
@@ -69,4 +71,17 @@ The Yodeck ID is used directly as the SNMP table index, so OIDs are stable and p
**Docker entrypoint** (`entrypoint.sh`) templates `/etc/snmp/snmpd.conf` from env vars at startup, then starts `snmpd` in the background before handing off to `python main.py`.
**Zabbix integration** (`app/zabbix.py`) targets Zabbix 6.0+ API (`item type 20` = SNMP agent). Set `ZABBIX_URL` to enable; the sync runs after every successful Yodeck poll.
## Zabbix integration details
Targets **Zabbix 7.x** (also works with 6.0+). Each player becomes a host:
- **Host name:** `yodeck-<id>` (e.g. `yodeck-54239`) — `#` is not valid in Zabbix 7.x host names
- **Visible name:** `QRS-<yodeck_name>` (e.g. `QRS-AMS-COF1`)
- **SNMP interface:** `APP_HOST:161`, SNMPv2c, community from `ZABBIX_SNMP_COMMUNITY`
- **Items:** `yodeck.online`, `yodeck.last_seen`, `yodeck.updating`, `yodeck.registered` — SNMP type 20, polled every 1 minute
**Authentication:** `ZABBIX_API_TOKEN` is sent as `Authorization: Bearer <token>` HTTP header (Zabbix 6.4+ style). If not set, falls back to `user.login` with `ZABBIX_USER`/`ZABBIX_PASSWORD`.
**Required Zabbix setup before first run:**
1. Create host group `Yodeck Players` manually in Zabbix
2. Grant the API token's user group **Read-write** permission on that group (Administration → User groups → Permissions)
3. The API token user needs at minimum **Zabbix Admin** role to create hosts and items