%~ include('./partials/head', { title: 'Monitors' }) %> <%~ include('./partials/nav', { nav: 'monitors' }) %> <% const upCount = it.monitors.filter(m => m.last_ping && m.last_ping.up === true).length; const downCount = it.monitors.filter(m => m.last_ping && m.last_ping.up === false).length; %> Monitors <% if (it.monitors.length > 0) { %><%= upCount %> up · <%= downCount %> down · <%= it.monitors.length %> total<% } %> + New <% if (it.monitors.length === 0) { %> No monitors yet Create your first monitor to start tracking uptime Create your first monitor <% } else { %> <% it.monitors.forEach(function(m) { const latencies = (m.pings || []).filter(p => p.latency_ms != null); // Pick the region with the lowest avg latency (same logic as sparklineFromPings) const byRegion = {}; for (const p of latencies) { const key = p.region || '__none__'; if (!byRegion[key]) byRegion[key] = []; byRegion[key].push(p.latency_ms); } let bestRegion = '__none__', bestAvg = Infinity; for (const [region, vals] of Object.entries(byRegion)) { const avg = vals.reduce((a, b) => a + b, 0) / vals.length; if (avg < bestAvg) { bestAvg = avg; bestRegion = region; } } const bestVals = byRegion[bestRegion] || []; const avgLatency = bestVals.length ? bestVals[bestVals.length - 1] : null; %> <%= m.name %> <%= m.url %> <%~ it.sparklineSSR(latencies) %> <%= avgLatency != null ? avgLatency + 'ms' : '—' %> <%~ m.last_ping ? it.timeAgoSSR(m.last_ping.checked_at) : 'no pings' %> <%= m.enabled ? m.interval_s + 's' : 'paused' %> <% }) %> <% } %> <%~ include('./partials/foot') %>
No monitors yet
Create your first monitor to start tracking uptime