Add Zabbix template with offline and last-seen triggers

- zabbix_template.yaml: importable template "Yodmon Yodeck Player"
  - 5 SNMP items using {$YODECK_ID} host macro for per-host OIDs
  - Trigger: offline warning after 30 minutes (yodeck.online < 1)
  - Trigger: last seen > 4 hours (now() - yodeck.last_seen_ts > 14400)
- snmp/pass_persist.py: add col 7 — last_seen as Unix timestamp
- app/zabbix.py: link hosts to template, upsert {$YODECK_ID} macro;
  existing hosts get template linked on next sync automatically
- app/config.py: add ZABBIX_TEMPLATE setting

Import zabbix_template.yaml once via Zabbix UI, then redeploy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 10:39:48 +02:00
parent c35850dc3d
commit e16b542d1b
5 changed files with 175 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ ZABBIX_API_TOKEN = os.environ.get('ZABBIX_API_TOKEN', '')
ZABBIX_USER = os.environ.get('ZABBIX_USER', 'Admin')
ZABBIX_PASSWORD = os.environ.get('ZABBIX_PASSWORD', '')
ZABBIX_HOST_GROUP = os.environ.get('ZABBIX_HOST_GROUP', 'Yodeck Players')
ZABBIX_TEMPLATE = os.environ.get('ZABBIX_TEMPLATE', 'Yodmon Yodeck Player')
ZABBIX_SNMP_COMMUNITY = os.environ.get('ZABBIX_SNMP_COMMUNITY', 'public')
# IP/hostname of this app reachable by the Zabbix server for SNMP polling
APP_HOST = os.environ.get('APP_HOST', '127.0.0.1')