<%~ include('./partials/head', { title: 'Monitor', scripts: ['/dashboard/query-builder.js'] }) %> <%~ include('./partials/nav', { nav: 'monitors' }) %> <% const m = it.monitor; const pings = it.pings || []; const lastPing = pings[0]; const upPings = pings.filter(p => p.up); const latencies = pings.filter(p => p.latency_ms != null).map(p => p.latency_ms); const avgLatency = latencies.length ? Math.round(latencies.reduce((a, b) => a + b, 0) / latencies.length) : null; const uptime = pings.length ? Math.round((upPings.length / pings.length) * 100) : null; // Group pings by run_id for status bar const barRuns = []; const runMap = {}; for (const p of pings.slice(0, 120).reverse()) { const rid = p.run_id || p.checked_at; if (!runMap[rid]) { runMap[rid] = { run_id: rid, up: 0, down: 0, total: 0, checked_at: p.checked_at, regions: [] }; barRuns.push(runMap[rid]); } runMap[rid].total++; if (p.up) runMap[rid].up++; else runMap[rid].down++; runMap[rid].regions.push({ region: p.region || '', up: p.up, latency_ms: p.latency_ms }); } // Keep last 60 runs const barPings = barRuns.slice(-60); const chartPings = pings.slice().reverse(); %>
← Back
<%~ lastPing ? (lastPing.up ? '' : '') : '' %>

<%= m.name %>

<%= m.url %>

Status
<%~ lastPing ? (lastPing.up ? 'Up' : 'Down') : 'β€”' %>
Avg Latency
<%= avgLatency != null ? avgLatency + 'ms' : 'β€”' %>
Uptime
<%= uptime != null ? uptime + '%' : 'β€”' %>
Last Ping
<%~ lastPing ? it.timeAgoSSR(lastPing.checked_at) : 'β€”' %>

Response Time

<%~ it.latencyChartSSR(chartPings) %>

Status History

<% if (barPings.length > 0) { %> <% barPings.forEach(function(c) { const color = c.down === 0 ? 'bg-green-500/70' : (c.up === 0 ? 'bg-red-500/70' : 'bg-orange-400/70'); const regionsJson = JSON.stringify(c.regions).split('&').join('&').split('"').join('"').split('<').join('<').split(String.fromCharCode(62)).join('>'); %>
<% }) %> <% } else { %>
No data
<% } %>

Recent Pings

<% const regionFlag = { 'eu-central': 'πŸ‡©πŸ‡ͺ', 'us-west': 'πŸ‡ΊπŸ‡Έ', }; %> <% pings.slice(0, 30).forEach(function(c) { %> <% }) %>
Status Code Latency Region Run ID Time / Jitter Error
<%~ c.up ? 'Up' : 'Down' %> <%= c.status_code != null ? c.status_code : 'β€”' %> <%= c.latency_ms != null ? c.latency_ms + 'ms' : 'β€”' %> <%= c.region ? (regionFlag[c.region] || '🌐') + ' ' + c.region : 'β€”' %> <%= c.run_id || 'β€”' %> <%~ it.timeAgoSSR(c.checked_at) %><% if (c.jitter_ms != null) { %> (+<%= c.jitter_ms %>ms)<% } %> <%= c.error ? c.error : '' %>

Edit Monitor

<%~ include('./partials/monitor-form', { _form: { monitor: m, isEdit: true, prefix: 'edit-', bg: 'bg-gray-800/50', border: 'border-border-subtle' }, plan: it.plan }) %>
<%~ include('./partials/foot') %>