feat(syslog): a device through Docker's address is placed by its name, or a device address set on it (#6096)
The SNMP poll asks each device's sysName in the same GET and keeps it (snmp_003_sys_name). A syslog source told apart by name finds its own address from the SNMP device (reported or given name) or host of that name, so its lines reach the SNMP device's and host's pages again; the edit page gains Device address, which always wins (syslog_004). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ def _source(name, state, level=6, line="nfsd: server not responding", host=None)
|
||||
"hostname_seen": "synnas", "host": host, "first_seen_at": now - timedelta(days=1),
|
||||
"last_seen_at": now - timedelta(minutes=3), "lines_total": 1204,
|
||||
"severity": "err" if level == 3 else "info", "level": level, "last_line": line,
|
||||
"suggested_host": "h1", "rate": 12 if state == "accepted" else None, "sender": ""}
|
||||
"suggested_host": "h1", "rate": 12 if state == "accepted" else None, "sender": "", "device_address": ""}
|
||||
|
||||
|
||||
async def _render(app, role, **ctx):
|
||||
@@ -89,7 +89,11 @@ async def test_a_sender_on_dockers_own_network_is_called_out(app):
|
||||
async def test_devices_through_dockers_address_read_by_their_own_names(app):
|
||||
via = {**_source("SynNAS", "offered"), "address": "10.0.0.2", "docker_address": True, "sender": "SynNAS"}
|
||||
page = await _render(app, "admin", offered=[via, {**via, "id": "id-2", "sender": "AsusNAS"}])
|
||||
assert "through Docker's ingress, 10.0.0.2" in page and '<span class="mono">AsusNAS</span>' in page
|
||||
assert "through Docker's ingress" in page and '<span class="mono">AsusNAS</span>' in page
|
||||
assert '<span class="mono">192.168.0.7</span>, through Docker' not in page
|
||||
placed = await _render(app, "admin", offered=[{**via, "device_address": "192.168.0.7"}])
|
||||
assert '<span class="mono">192.168.0.7</span>, through Docker's ingress' not in placed
|
||||
assert '<span class="mono">192.168.0.7</span>, through Docker\'s ingress' in placed
|
||||
assert "can't be told apart" not in page and "not the device's" not in page
|
||||
alone = await _render(app, "admin", offered=[{**via, "sender": ""}])
|
||||
assert "carry no device name" in alone
|
||||
|
||||
Reference in New Issue
Block a user