<%~ 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; const barPings = pings.slice(0, 60).reverse(); 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) { %>
<% }) %> <% } else { %>
No data
<% } %>

Recent Pings

<% pings.slice(0, 30).forEach(function(c) { %> <% }) %>
Status Code Latency Time Error
<%~ c.up ? 'Up' : 'Down' %> <%= c.status_code != null ? c.status_code : '—' %> <%= c.latency_ms != null ? c.latency_ms + 'ms' : '—' %> <%~ it.timeAgoSSR(c.checked_at) %> <%= c.error ? c.error : '' %>

Edit Monitor

<% if (m.request_headers && typeof m.request_headers === 'object') { Object.entries(m.request_headers).forEach(function([k, v]) { %>
<% }) } %>

Define up/down conditions. Defaults to status < 400.

<%~ include('./partials/foot') %>