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:
51
dev_server.py
Normal file
51
dev_server.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Local development server for Yodmon.
|
||||
|
||||
Runs the web UI and Yodeck polling without Docker or snmpd.
|
||||
SNMP is not available in this mode — use Docker for full testing.
|
||||
|
||||
Usage:
|
||||
pip install flask requests apscheduler
|
||||
python dev_server.py
|
||||
Open http://localhost:8080
|
||||
"""
|
||||
import os
|
||||
import logging
|
||||
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# Override paths/settings before importing app modules.
|
||||
# All of these can also be set as real environment variables.
|
||||
os.environ.setdefault('DB_PATH', os.path.join(_HERE, 'data', 'yodmon.db'))
|
||||
os.environ.setdefault('YODECK_API_TOKEN', 'yodeck:fXQKm1hLvJY88necL3GiLVntpmyNS5BpKp8MpDK8GH2UvCPrg8BeHwpBSQaEtF0q')
|
||||
os.environ.setdefault('WEB_PORT', '8080')
|
||||
|
||||
# Zabbix sync is optional — leave ZABBIX_URL empty to skip it
|
||||
os.environ.setdefault('ZABBIX_URL', '')
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format='%(asctime)s %(levelname)s %(name)s: %(message)s',
|
||||
)
|
||||
|
||||
from app.config import DB_PATH, WEB_PORT
|
||||
from app.database import init_db
|
||||
from app.scheduler import start_scheduler
|
||||
from app.web import create_app
|
||||
|
||||
if __name__ == '__main__':
|
||||
print("=" * 60)
|
||||
print(" Yodmon — dev server")
|
||||
print(f" DB : {DB_PATH}")
|
||||
print(f" URL : http://localhost:{WEB_PORT}")
|
||||
print(" SNMP: not available (Linux/Docker only)")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
os.makedirs(os.path.dirname(os.path.abspath(DB_PATH)), exist_ok=True)
|
||||
init_db()
|
||||
start_scheduler()
|
||||
|
||||
app = create_app()
|
||||
app.run(host='127.0.0.1', port=WEB_PORT, use_reloader=False)
|
||||
Reference in New Issue
Block a user