Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8dd744b039 | |||
| 9e2be150b5 | |||
| ed5ba5c59e | |||
| 2be44d8b24 | |||
| 2d6dcd782f | |||
| a1a3a52dd8 | |||
| bcc2ad7f5c |
+2
-2
@@ -68,7 +68,7 @@ class DiagnosticsRunner:
|
|||||||
f' echo "=== ip_route ===";'
|
f' echo "=== ip_route ===";'
|
||||||
f' ip route show dev {q} 2>/dev/null;'
|
f' ip route show dev {q} 2>/dev/null;'
|
||||||
f' echo "=== dmesg ===";'
|
f' echo "=== dmesg ===";'
|
||||||
f' dmesg 2>/dev/null | grep {q} | tail -50;'
|
f' dmesg 2>/dev/null | grep -F -- {q} | tail -50;'
|
||||||
f' echo "=== lldpctl ===";'
|
f' echo "=== lldpctl ===";'
|
||||||
f' lldpctl 2>/dev/null || echo "lldpd not running";'
|
f' lldpctl 2>/dev/null || echo "lldpd not running";'
|
||||||
f' echo "=== end ==="'
|
f' echo "=== end ==="'
|
||||||
@@ -78,7 +78,7 @@ class DiagnosticsRunner:
|
|||||||
f'ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5 '
|
f'ssh -o StrictHostKeyChecking=accept-new -o ConnectTimeout=5 '
|
||||||
f'-o BatchMode=yes -o LogLevel=ERROR '
|
f'-o BatchMode=yes -o LogLevel=ERROR '
|
||||||
f'-o ServerAliveInterval=10 -o ServerAliveCountMax=2 '
|
f'-o ServerAliveInterval=10 -o ServerAliveCountMax=2 '
|
||||||
f'root@{ip_q} \'{remote_cmd}\''
|
f'root@{ip_q} {shlex.quote(remote_cmd)}'
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|||||||
+9
-9
@@ -734,7 +734,7 @@ class NetworkMonitor:
|
|||||||
f'Interface {iface} on {host} went link-down ({_now_utc()})',
|
f'Interface {iface} on {host} went link-down ({_now_utc()})',
|
||||||
)
|
)
|
||||||
if not sup and consec >= self.fail_thresh:
|
if not sup and consec >= self.fail_thresh:
|
||||||
self._ticket_interface(event_id, is_new, host, iface, consec)
|
self._ticket_interface(event_id, host, iface, consec)
|
||||||
|
|
||||||
if host_has_regression:
|
if host_has_regression:
|
||||||
hosts_with_regression.append(host)
|
hosts_with_regression.append(host)
|
||||||
@@ -771,7 +771,7 @@ class NetworkMonitor:
|
|||||||
db.resolve_event('cluster_network_issue', self.cluster_name, '')
|
db.resolve_event('cluster_network_issue', self.cluster_name, '')
|
||||||
|
|
||||||
def _ticket_interface(
|
def _ticket_interface(
|
||||||
self, event_id: int, is_new: bool, host: str, iface: str, consec: int
|
self, event_id: int, host: str, iface: str, consec: int
|
||||||
) -> None:
|
) -> None:
|
||||||
title = (
|
title = (
|
||||||
f'[{host}][auto][production][issue][network][single-node] '
|
f'[{host}][auto][production][issue][network][single-node] '
|
||||||
@@ -789,7 +789,7 @@ class NetworkMonitor:
|
|||||||
f'Please inspect the cable/SFP/switch port for {host}/{iface}.'
|
f'Please inspect the cable/SFP/switch port for {host}/{iface}.'
|
||||||
)
|
)
|
||||||
tid = self.tickets.create(title, desc, priority='2')
|
tid = self.tickets.create(title, desc, priority='2')
|
||||||
if tid and is_new:
|
if tid:
|
||||||
db.set_ticket_id(event_id, tid)
|
db.set_ticket_id(event_id, tid)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@@ -810,11 +810,11 @@ class NetworkMonitor:
|
|||||||
f'UniFi {name} ({d.get("ip","")}) offline ({_now_utc()})',
|
f'UniFi {name} ({d.get("ip","")}) offline ({_now_utc()})',
|
||||||
)
|
)
|
||||||
if not sup and consec >= self.fail_thresh:
|
if not sup and consec >= self.fail_thresh:
|
||||||
self._ticket_unifi(event_id, is_new, d)
|
self._ticket_unifi(event_id, d)
|
||||||
else:
|
else:
|
||||||
db.resolve_event('unifi_device_offline', name, d.get('type', ''))
|
db.resolve_event('unifi_device_offline', name, d.get('type', ''))
|
||||||
|
|
||||||
def _ticket_unifi(self, event_id: int, is_new: bool, device: dict) -> None:
|
def _ticket_unifi(self, event_id: int, device: dict) -> None:
|
||||||
name = device['name']
|
name = device['name']
|
||||||
title = (
|
title = (
|
||||||
f'[{name}][auto][production][issue][network][single-node] '
|
f'[{name}][auto][production][issue][network][single-node] '
|
||||||
@@ -831,7 +831,7 @@ class NetworkMonitor:
|
|||||||
f'Please check power and cable connectivity.'
|
f'Please check power and cable connectivity.'
|
||||||
)
|
)
|
||||||
tid = self.tickets.create(title, desc, priority='2')
|
tid = self.tickets.create(title, desc, priority='2')
|
||||||
if tid and is_new:
|
if tid:
|
||||||
db.set_ticket_id(event_id, tid)
|
db.set_ticket_id(event_id, tid)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@@ -850,12 +850,12 @@ class NetworkMonitor:
|
|||||||
f'Host {name} ({ip}) unreachable via ping ({_now_utc()})',
|
f'Host {name} ({ip}) unreachable via ping ({_now_utc()})',
|
||||||
)
|
)
|
||||||
if not sup and consec >= self.fail_thresh:
|
if not sup and consec >= self.fail_thresh:
|
||||||
self._ticket_unreachable(event_id, is_new, name, ip, consec)
|
self._ticket_unreachable(event_id, name, ip, consec)
|
||||||
else:
|
else:
|
||||||
db.resolve_event('host_unreachable', name, ip)
|
db.resolve_event('host_unreachable', name, ip)
|
||||||
|
|
||||||
def _ticket_unreachable(
|
def _ticket_unreachable(
|
||||||
self, event_id: int, is_new: bool, name: str, ip: str, consec: int
|
self, event_id: int, name: str, ip: str, consec: int
|
||||||
) -> None:
|
) -> None:
|
||||||
title = (
|
title = (
|
||||||
f'[{name}][auto][production][issue][network][single-node] '
|
f'[{name}][auto][production][issue][network][single-node] '
|
||||||
@@ -873,7 +873,7 @@ class NetworkMonitor:
|
|||||||
f'Please check the host power, management interface, and network connectivity.'
|
f'Please check the host power, management interface, and network connectivity.'
|
||||||
)
|
)
|
||||||
tid = self.tickets.create(title, desc, priority='2')
|
tid = self.tickets.create(title, desc, priority='2')
|
||||||
if tid and is_new:
|
if tid:
|
||||||
db.set_ticket_id(event_id, tid)
|
db.set_ticket_id(event_id, tid)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|||||||
@@ -324,6 +324,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="host-grid" id="host-grid">
|
<div class="host-grid" id="host-grid">
|
||||||
|
{%- set has_global_sup = suppressions | selectattr('target_type', 'equalto', 'all') | list | length > 0 -%}
|
||||||
{% for name, host in snapshot.hosts.items() %}
|
{% for name, host in snapshot.hosts.items() %}
|
||||||
{% set suppressed = suppressions | selectattr('target_name', 'equalto', name) | list %}
|
{% set suppressed = suppressions | selectattr('target_name', 'equalto', name) | list %}
|
||||||
<div class="host-card host-card-{{ host.status }}" data-host="{{ name }}">
|
<div class="host-card host-card-{{ host.status }}" data-host="{{ name }}">
|
||||||
@@ -331,7 +332,7 @@
|
|||||||
<div class="host-name-row">
|
<div class="host-name-row">
|
||||||
<span class="host-status-dot dot-{{ host.status }}"></span>
|
<span class="host-status-dot dot-{{ host.status }}"></span>
|
||||||
<span class="host-name">{{ name }}</span>
|
<span class="host-name">{{ name }}</span>
|
||||||
{% if suppressed %}
|
{% if suppressed or has_global_sup %}
|
||||||
<span class="badge-suppressed" title="Suppressed">🔕</span>
|
<span class="badge-suppressed" title="Suppressed">🔕</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ let _apiData = null;
|
|||||||
function selectPort(el) {
|
function selectPort(el) {
|
||||||
const swName = el.dataset.switch;
|
const swName = el.dataset.switch;
|
||||||
const idx = parseInt(el.dataset.portIdx, 10);
|
const idx = parseInt(el.dataset.portIdx, 10);
|
||||||
|
if (_diagPollTimer) { clearInterval(_diagPollTimer); _diagPollTimer = null; }
|
||||||
document.querySelectorAll('.switch-port-block.selected')
|
document.querySelectorAll('.switch-port-block.selected')
|
||||||
.forEach(e => e.classList.remove('selected'));
|
.forEach(e => e.classList.remove('selected'));
|
||||||
el.classList.add('selected');
|
el.classList.add('selected');
|
||||||
|
|||||||
+12
-8
@@ -372,14 +372,16 @@ function togglePanel(panel) {
|
|||||||
if (title) title.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
|
if (title) title.setAttribute('aria-expanded', isCollapsed ? 'false' : 'true');
|
||||||
const id = panel.id;
|
const id = panel.id;
|
||||||
if (id) {
|
if (id) {
|
||||||
const collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}');
|
let collapsed = {};
|
||||||
|
try { collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); } catch(_) {}
|
||||||
collapsed[id] = panel.classList.contains('collapsed');
|
collapsed[id] = panel.classList.contains('collapsed');
|
||||||
sessionStorage.setItem('linksCollapsed', JSON.stringify(collapsed));
|
try { sessionStorage.setItem('linksCollapsed', JSON.stringify(collapsed)); } catch(_) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCollapseState() {
|
function restoreCollapseState() {
|
||||||
const collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}');
|
let collapsed = {};
|
||||||
|
try { collapsed = JSON.parse(sessionStorage.getItem('linksCollapsed') || '{}'); } catch(_) {}
|
||||||
for (const [id, isCollapsed] of Object.entries(collapsed)) {
|
for (const [id, isCollapsed] of Object.entries(collapsed)) {
|
||||||
const panel = document.getElementById(id);
|
const panel = document.getElementById(id);
|
||||||
if (!panel) continue;
|
if (!panel) continue;
|
||||||
@@ -507,9 +509,11 @@ function collapseAll() {
|
|||||||
if (btn) btn.textContent = '[+]';
|
if (btn) btn.textContent = '[+]';
|
||||||
if (title) title.setAttribute('aria-expanded', 'false');
|
if (title) title.setAttribute('aria-expanded', 'false');
|
||||||
});
|
});
|
||||||
sessionStorage.setItem('linksCollapsed', JSON.stringify(
|
try {
|
||||||
Object.fromEntries([...document.querySelectorAll('.link-host-panel')].map(p => [p.id, true]))
|
sessionStorage.setItem('linksCollapsed', JSON.stringify(
|
||||||
));
|
Object.fromEntries([...document.querySelectorAll('.link-host-panel')].map(p => [p.id, true]))
|
||||||
|
));
|
||||||
|
} catch(_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandAll() {
|
function expandAll() {
|
||||||
@@ -520,7 +524,7 @@ function expandAll() {
|
|||||||
if (btn) btn.textContent = '[–]';
|
if (btn) btn.textContent = '[–]';
|
||||||
if (title) title.setAttribute('aria-expanded', 'true');
|
if (title) title.setAttribute('aria-expanded', 'true');
|
||||||
});
|
});
|
||||||
sessionStorage.setItem('linksCollapsed', '{}');
|
try { sessionStorage.setItem('linksCollapsed', '{}'); } catch(_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Stale data warning ────────────────────────────────────────────
|
// ── Stale data warning ────────────────────────────────────────────
|
||||||
@@ -548,7 +552,7 @@ function checkLinksStale(updatedStr) {
|
|||||||
async function loadLinks() {
|
async function loadLinks() {
|
||||||
try {
|
try {
|
||||||
const data = await lt.api.get('/api/links');
|
const data = await lt.api.get('/api/links');
|
||||||
if (!data.hosts && !data.unifi_switches) {
|
if ((!data.hosts || !Object.keys(data.hosts).length) && (!data.unifi_switches || !Object.keys(data.unifi_switches).length)) {
|
||||||
document.getElementById('links-container').innerHTML =
|
document.getElementById('links-container').innerHTML =
|
||||||
'<div class="link-no-data">No link data yet — monitor has not completed a full cycle.</div>';
|
'<div class="link-no-data">No link data yet — monitor has not completed a full cycle.</div>';
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user