Replace # with - in Zabbix host names (Zabbix 7.x compatibility)

Zabbix 7.x rejects '#' in host names. Changed hostname format from
'yodeck#<id>' to 'yodeck-<id>' (e.g. yodeck-54239).
Updated SNMP col 1 value and docs for consistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 10:21:05 +02:00
parent fc6a0c1605
commit 5db8beb847
4 changed files with 7 additions and 7 deletions

View File

@@ -54,7 +54,7 @@ Web UI
``` ```
**SNMP OID structure**`ENTERPRISE_OID.1.1.<column>.<yodeck_id>`: **SNMP OID structure**`ENTERPRISE_OID.1.1.<column>.<yodeck_id>`:
- col 1 `STRING` hostname (`yodeck#<id>`) - col 1 `STRING` hostname (`yodeck-<id>`)
- col 2 `STRING` display name - col 2 `STRING` display name
- col 3 `INTEGER` online (0/1) - col 3 `INTEGER` online (0/1)
- col 4 `STRING` last_seen (ISO-8601) - col 4 `STRING` last_seen (ISO-8601)

View File

@@ -2,7 +2,7 @@
Zabbix API client for automatic host management. Zabbix API client for automatic host management.
Each Yodeck player becomes a Zabbix host with: Each Yodeck player becomes a Zabbix host with:
- hostname : yodeck#<yodeck_id> - hostname : yodeck-<yodeck_id>
- visible name: "QRS-" + the Yodeck player's display name (e.g. QRS-AMS-COF1) - visible name: "QRS-" + the Yodeck player's display name (e.g. QRS-AMS-COF1)
- SNMP v2c interface pointing to this app (APP_HOST:161) - SNMP v2c interface pointing to this app (APP_HOST:161)
- Four SNMP items: online, last_seen, updating, registered - Four SNMP items: online, last_seen, updating, registered
@@ -171,7 +171,7 @@ def sync_to_zabbix(players, add_log_fn):
created = updated = 0 created = updated = 0
for player in players: for player in players:
yid = player['id'] yid = player['id']
hostname = f"yodeck#{yid}" hostname = f"yodeck-{yid}"
visible = f"QRS-{player['name']}" visible = f"QRS-{player['name']}"
if hostname not in existing: if hostname not in existing:

View File

@@ -5,7 +5,7 @@ net-snmp pass_persist handler for Yodmon.
Reads player data from the SQLite database and serves it over SNMP v2c. Reads player data from the SQLite database and serves it over SNMP v2c.
OID layout (base = ENTERPRISE_OID.1.1): OID layout (base = ENTERPRISE_OID.1.1):
base.1.<yodeck_id> STRING "yodeck#<id>" base.1.<yodeck_id> STRING "yodeck-<id>"
base.2.<yodeck_id> STRING player display name base.2.<yodeck_id> STRING player display name
base.3.<yodeck_id> INTEGER online (1 = online, 0 = offline) base.3.<yodeck_id> INTEGER online (1 = online, 0 = offline)
base.4.<yodeck_id> STRING last_seen (ISO-8601 timestamp) base.4.<yodeck_id> STRING last_seen (ISO-8601 timestamp)
@@ -27,7 +27,7 @@ BASE_OID = f"{ENTERPRISE_OID}.1.1"
# (column_index, snmp_type, value_extractor) # (column_index, snmp_type, value_extractor)
COLUMNS = [ COLUMNS = [
(1, 'STRING', lambda p: f"yodeck#{p['id']}"), (1, 'STRING', lambda p: f"yodeck-{p['id']}"),
(2, 'STRING', lambda p: p.get('name') or ''), (2, 'STRING', lambda p: p.get('name') or ''),
(3, 'INTEGER', lambda p: str(p.get('online', 0))), (3, 'INTEGER', lambda p: str(p.get('online', 0))),
(4, 'STRING', lambda p: p.get('last_seen') or ''), (4, 'STRING', lambda p: p.get('last_seen') or ''),

View File

@@ -25,7 +25,7 @@ from app.config import DB_PATH, ENTERPRISE_OID
from app.database import get_all_players, get_player_counts from app.database import get_all_players, get_player_counts
COLUMNS = [ COLUMNS = [
(1, 'STRING', 'hostname', lambda p: f"yodeck#{p['id']}"), (1, 'STRING', 'hostname', lambda p: f"yodeck-{p['id']}"),
(2, 'STRING', 'name', lambda p: p.get('name') or ''), (2, 'STRING', 'name', lambda p: p.get('name') or ''),
(3, 'INTEGER', 'online', lambda p: str(p.get('online', 0))), (3, 'INTEGER', 'online', lambda p: str(p.get('online', 0))),
(4, 'STRING', 'last_seen', lambda p: p.get('last_seen') or ''), (4, 'STRING', 'last_seen', lambda p: p.get('last_seen') or ''),
@@ -62,7 +62,7 @@ def main():
for p in players: for p in players:
pid = p['id'] pid = p['id']
print(f" -- yodeck#{pid} ({p['name']})") print(f" -- yodeck-{pid} ({p['name']})")
for col, typ, label, getter in COLUMNS: for col, typ, label, getter in COLUMNS:
oid = f".{base}.{col}.{pid}" oid = f".{base}.{col}.{pid}"
val = getter(p) val = getter(p)