Initial commit: Yodmon Yodeck→Zabbix bridge
- Yodeck API poller (every 10 min, paginated, 310 players) - SQLite persistence (players + activity logs) - SNMP v2c agent via net-snmp pass_persist - Zabbix API auto host creation/update (6.0+) - Flask web dashboard with live player status and log - Docker deployment with persistent volume - dev_server.py for local testing without Docker Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
25
app/yodeck.py
Normal file
25
app/yodeck.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import logging
|
||||
import requests
|
||||
from app.config import YODECK_API_TOKEN, YODECK_API_BASE
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_all_screens():
|
||||
"""Fetch all screens/players from the Yodeck API (handles pagination)."""
|
||||
if not YODECK_API_TOKEN:
|
||||
raise RuntimeError("YODECK_API_TOKEN is not configured")
|
||||
|
||||
headers = {'Authorization': f'Token {YODECK_API_TOKEN}'}
|
||||
players = []
|
||||
url = f'{YODECK_API_BASE}/screens/'
|
||||
|
||||
while url:
|
||||
log.debug("GET %s", url)
|
||||
resp = requests.get(url, headers=headers, timeout=30)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
players.extend(data.get('results', []))
|
||||
url = data.get('next')
|
||||
|
||||
return players
|
||||
Reference in New Issue
Block a user