Files
Yodmon/app/web.py
Christoph Gasser 9fc3e97546 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>
2026-04-17 09:31:00 +02:00

33 lines
845 B
Python

from flask import Flask, jsonify, render_template
from app import database as db
def create_app():
app = Flask(__name__, template_folder='../templates')
@app.route('/')
def index():
total, online = db.get_player_counts()
return render_template(
'index.html',
total=total,
online=online,
players=db.get_all_players(),
logs=db.get_recent_logs(200),
)
@app.route('/api/stats')
def api_stats():
total, online = db.get_player_counts()
return jsonify({'total': total, 'online': online, 'offline': total - online})
@app.route('/api/players')
def api_players():
return jsonify(db.get_all_players())
@app.route('/api/logs')
def api_logs():
return jsonify(db.get_recent_logs(100))
return app