Implement all vendor integrations, WAN graphs, and FortiGate health panel

- Wire up 26 vendor providers: Atlassian Statuspage API, Status.io, Instatus,
  AWS RSS feeds, Apple/Google JSON feeds, M365 Graph API, and synthetic checks
- Add 11 new providers: AWS, Cloudflare, SmartPass, School Dismissal Manager,
  SherpaDesk, Classkick, ClassDojo, Savvas, Study Island, Promethean, RAZ-Kids
- Rename Local Infrastructure → Internet (TCP check to 8.8.8.8:53)
- Add WAN throughput graph section: dual-link canvas graphs (Crown Castle +
  Comcast) polling FortiGate REST API every 30s with 30-min rolling history
- Add FortiGate health card: uptime, CPU %, memory % from FortiOS API
- Add /api/throughput and /api/fortigate-health endpoints
- Add README with setup instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Klein
2026-02-20 13:46:13 -05:00
parent 7d8cde8f92
commit 51eb3bf7c8
39 changed files with 1776 additions and 59 deletions
+155
View File
@@ -158,6 +158,150 @@ header {
font-size: 0.85rem;
}
/* ===== WAN THROUGHPUT ===== */
#wan-section {
padding: 1.5rem 2.5rem 0;
}
#wan-graphs {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.25rem;
}
.wan-panel {
background: var(--surface);
border: 1px solid var(--border);
border-top: 3px solid #388bfd;
border-radius: 8px;
padding: 1.25rem 1.5rem 1rem;
overflow: hidden;
}
.wan-panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.wan-name {
font-family: var(--font-display);
font-size: 1.1rem;
font-weight: 800;
color: var(--text-1);
letter-spacing: 0.03em;
line-height: 1;
}
.wan-legend {
display: flex;
gap: 1.25rem;
}
.wan-legend-item {
display: flex;
align-items: center;
gap: 0.4rem;
font-family: var(--font-mono);
font-size: 0.68rem;
color: var(--text-2);
}
.wan-legend-dot {
width: 7px;
height: 7px;
border-radius: 50%;
flex-shrink: 0;
}
.wan-legend-dot.rx { background: #58a6ff; box-shadow: 0 0 5px rgba(88, 166, 255, 0.5); }
.wan-legend-dot.tx { background: #3fb950; box-shadow: 0 0 5px rgba(63, 185, 80, 0.5); }
.wan-canvas {
display: block;
width: 100%;
height: 90px;
}
/* ===== FORTIGATE HEALTH CARD ===== */
#fg-health-card {
display: flex;
align-items: center;
gap: 2rem;
margin-top: 1.25rem;
background: var(--surface);
border: 1px solid var(--border);
border-top: 3px solid #388bfd;
border-radius: 8px;
padding: 1rem 1.5rem;
}
.fg-identity {
display: flex;
align-items: center;
gap: 0.65rem;
flex-shrink: 0;
}
.fg-model {
font-family: var(--font-display);
font-size: 1.1rem;
font-weight: 800;
color: var(--text-1);
letter-spacing: 0.03em;
line-height: 1;
}
.fg-metrics {
display: flex;
gap: 2rem;
flex-wrap: wrap;
}
.fg-metric {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.fg-metric-label {
font-family: var(--font-mono);
font-size: 0.6rem;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-3);
}
.fg-metric-value {
font-family: var(--font-mono);
font-size: 0.85rem;
font-weight: 400;
color: var(--text-1);
}
.fg-metric-value.warn { color: var(--warn); }
.fg-metric-value.crit { color: var(--crit); }
@media (max-width: 640px) {
#wan-section {
padding: 1.25rem 1.5rem 0;
}
#wan-graphs {
grid-template-columns: 1fr;
}
#fg-health-card {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
}
/* ===== VENDOR GRID ===== */
#vendor-grid {
@@ -269,6 +413,17 @@ header {
/* --- Vendor name --- */
.vendor-name a.vendor-link {
color: inherit;
text-decoration: none;
}
.vendor-name a.vendor-link:hover {
text-decoration: underline;
text-decoration-color: var(--text-3);
text-underline-offset: 3px;
}
.vendor-name {
font-family: var(--font-display);
font-size: 1.35rem;
+52
View File
@@ -21,6 +21,58 @@
</div>
</header>
<div id="summary-bar"></div>
<section id="wan-section">
<div id="wan-graphs">
<div class="wan-panel">
<div class="wan-panel-header">
<span class="wan-name" id="wan1-name">Crown Castle</span>
<div class="wan-legend">
<span class="wan-legend-item"><span class="wan-legend-dot rx"></span><span id="wan1-rx">— Mbps ↓</span></span>
<span class="wan-legend-item"><span class="wan-legend-dot tx"></span><span id="wan1-tx">— Mbps ↑</span></span>
</div>
</div>
<canvas id="wan1-canvas" class="wan-canvas"></canvas>
</div>
<div class="wan-panel">
<div class="wan-panel-header">
<span class="wan-name" id="wan2-name">Comcast</span>
<div class="wan-legend">
<span class="wan-legend-item"><span class="wan-legend-dot rx"></span><span id="wan2-rx">— Mbps ↓</span></span>
<span class="wan-legend-item"><span class="wan-legend-dot tx"></span><span id="wan2-tx">— Mbps ↑</span></span>
</div>
</div>
<canvas id="wan2-canvas" class="wan-canvas"></canvas>
</div>
</div>
<div id="fg-health-card">
<div class="fg-identity">
<span class="status-indicator operational" id="fg-status-dot"></span>
<span class="fg-model" id="fg-model">FortiGate 1800F</span>
</div>
<div class="fg-metrics">
<div class="fg-metric">
<span class="fg-metric-label">Hostname</span>
<span class="fg-metric-value" id="fg-hostname"></span>
</div>
<div class="fg-metric">
<span class="fg-metric-label">Version</span>
<span class="fg-metric-value" id="fg-version"></span>
</div>
<div class="fg-metric">
<span class="fg-metric-label">Uptime</span>
<span class="fg-metric-value" id="fg-uptime"></span>
</div>
<div class="fg-metric">
<span class="fg-metric-label">CPU</span>
<span class="fg-metric-value" id="fg-cpu"></span>
</div>
<div class="fg-metric">
<span class="fg-metric-label">Memory</span>
<span class="fg-metric-value" id="fg-mem"></span>
</div>
</div>
</div>
</section>
<main id="vendor-grid"></main>
<script src="js/app.js"></script>
</body>
+183 -4
View File
@@ -1,6 +1,9 @@
// How often to fetch status (ms)
const REFRESH_INTERVAL = 60_000;
// How often to fetch WAN throughput (ms) — matches backend poll rate
const THROUGHPUT_INTERVAL = 30_000;
// Status severity for sorting (higher = more severe = shown first)
const SEVERITY = { outage: 3, degraded: 2, unknown: 1, operational: 0 };
@@ -169,20 +172,26 @@ function renderSummary(vendors) {
// Render vendor cards into the grid, sorted by severity
function renderGrid(vendors) {
const sorted = [...vendors].sort((a, b) =>
(SEVERITY[b.status] || 0) - (SEVERITY[a.status] || 0)
);
const sorted = [...vendors].sort((a, b) => {
const severityDiff = (SEVERITY[b.status] || 0) - (SEVERITY[a.status] || 0);
if (severityDiff !== 0) return severityDiff;
return a.name.localeCompare(b.name);
});
const grid = document.getElementById("vendor-grid");
grid.innerHTML = sorted.map((v, i) => {
const animClass = initialLoad ? "animate-in" : "";
const animStyle = initialLoad ? `style="--d: ${i * 0.07}s"` : "";
const nameHtml = v.url
? `<a href="${esc(v.url)}" target="_blank" rel="noopener" class="vendor-link">${esc(v.name)}</a>`
: esc(v.name);
return `<div class="vendor-card ${esc(v.status)} ${animClass}" ${animStyle}>
<div class="card-header">
<div class="vendor-identity">
<span class="status-indicator ${esc(v.status)}"></span>
<span class="vendor-name">${esc(v.name)}</span>
<span class="vendor-name">${nameHtml}</span>
</div>
<span class="status-badge ${esc(v.status)}">${esc(v.status)}</span>
</div>
@@ -216,8 +225,178 @@ async function refresh() {
render(vendors);
}
// ===== WAN THROUGHPUT GRAPH =====
async function fetchThroughput() {
try {
const res = await fetch("/api/throughput");
if (!res.ok) throw new Error(res.statusText);
return await res.json();
} catch {
return [];
}
}
// Round up to the nearest "nice" scale value for the Y axis
function niceMax(val) {
const steps = [10, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000];
return steps.find((s) => s >= val) ?? Math.ceil(val * 1.2);
}
function fmtMbps(mbps) {
if (mbps >= 1000) return `${(mbps / 1000).toFixed(1)} Gbps`;
if (mbps >= 100) return `${Math.round(mbps)} Mbps`;
if (mbps >= 10) return `${mbps.toFixed(1)} Mbps`;
return `${mbps.toFixed(2)} Mbps`;
}
function drawGraph(canvas, points, wanKey) {
const dpr = window.devicePixelRatio || 1;
const W = canvas.offsetWidth;
const H = canvas.offsetHeight;
canvas.width = W * dpr;
canvas.height = H * dpr;
const ctx = canvas.getContext("2d");
ctx.scale(dpr, dpr);
ctx.clearRect(0, 0, W, H);
if (points.length < 2) {
ctx.fillStyle = "#484f58";
ctx.font = "11px Consolas, monospace";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText("Waiting for data…", W / 2, H / 2);
return;
}
const PAD = { top: 6, right: 6, bottom: 4, left: 42 };
const plotW = W - PAD.left - PAD.right;
const plotH = H - PAD.top - PAD.bottom;
const allVals = points.flatMap((p) => [p[wanKey].rxMbps, p[wanKey].txMbps]);
const maxVal = niceMax(Math.max(...allVals, 1));
// Grid lines and Y-axis labels
ctx.font = "9px Consolas, monospace";
ctx.textAlign = "right";
ctx.textBaseline = "middle";
[0, 0.5, 1].forEach((frac) => {
const y = PAD.top + plotH * (1 - frac);
ctx.strokeStyle = "#21262d";
ctx.lineWidth = 1;
ctx.beginPath();
ctx.moveTo(PAD.left, y);
ctx.lineTo(PAD.left + plotW, y);
ctx.stroke();
if (frac > 0) {
ctx.fillStyle = "#484f58";
ctx.fillText(fmtMbps(maxVal * frac), PAD.left - 5, y);
}
});
// Draw a line with a fill underneath
function drawLine(getValue, strokeColor, fillColor) {
const n = points.length;
const pts = points.map((p, i) => ({
x: PAD.left + (i / (n - 1)) * plotW,
y: PAD.top + plotH * (1 - Math.max(0, getValue(p)) / maxVal),
}));
// Fill
ctx.beginPath();
ctx.moveTo(pts[0].x, PAD.top + plotH);
pts.forEach((pt) => ctx.lineTo(pt.x, pt.y));
ctx.lineTo(pts[n - 1].x, PAD.top + plotH);
ctx.closePath();
ctx.fillStyle = fillColor;
ctx.fill();
// Stroke
ctx.beginPath();
pts.forEach((pt, i) => (i === 0 ? ctx.moveTo(pt.x, pt.y) : ctx.lineTo(pt.x, pt.y)));
ctx.strokeStyle = strokeColor;
ctx.lineWidth = 1.5;
ctx.lineJoin = "round";
ctx.stroke();
}
drawLine((p) => p[wanKey].rxMbps, "#58a6ff", "rgba(88, 166, 255, 0.10)");
drawLine((p) => p[wanKey].txMbps, "#3fb950", "rgba(63, 185, 80, 0.10)");
}
function renderThroughput(points) {
if (points.length === 0) return;
const latest = points[points.length - 1];
// Update labels from the data (picks up names from .env via backend)
document.getElementById("wan1-name").textContent = latest.wan1.label;
document.getElementById("wan2-name").textContent = latest.wan2.label;
document.getElementById("wan1-rx").textContent = `${fmtMbps(latest.wan1.rxMbps)}`;
document.getElementById("wan1-tx").textContent = `${fmtMbps(latest.wan1.txMbps)}`;
document.getElementById("wan2-rx").textContent = `${fmtMbps(latest.wan2.rxMbps)}`;
document.getElementById("wan2-tx").textContent = `${fmtMbps(latest.wan2.txMbps)}`;
drawGraph(document.getElementById("wan1-canvas"), points, "wan1");
drawGraph(document.getElementById("wan2-canvas"), points, "wan2");
}
async function refreshThroughput() {
const points = await fetchThroughput();
renderThroughput(points);
}
// ===== FORTIGATE HEALTH CARD =====
async function fetchFgHealth() {
try {
const res = await fetch("/api/fortigate-health");
if (!res.ok) return null;
return await res.json();
} catch {
return null;
}
}
function renderFgHealth(health) {
if (!health) return;
document.getElementById("fg-model").textContent =
`FortiGate ${health.model}`;
document.getElementById("fg-hostname").textContent = health.hostname;
document.getElementById("fg-version").textContent = health.version;
document.getElementById("fg-uptime").textContent = health.uptimeLabel;
const cpuEl = document.getElementById("fg-cpu");
cpuEl.textContent = health.cpuPct !== null ? `${health.cpuPct}%` : "—";
cpuEl.className = "fg-metric-value" +
(health.cpuPct >= 90 ? " crit" : health.cpuPct >= 75 ? " warn" : "");
const memEl = document.getElementById("fg-mem");
memEl.textContent = health.memPct !== null ? `${health.memPct}%` : "—";
memEl.className = "fg-metric-value" +
(health.memPct >= 90 ? " crit" : health.memPct >= 75 ? " warn" : "");
const dot = document.getElementById("fg-status-dot");
const stressed = health.cpuPct >= 90 || health.memPct >= 90;
dot.className = `status-indicator ${stressed ? "degraded" : "operational"}`;
}
async function refreshFgHealth() {
const health = await fetchFgHealth();
renderFgHealth(health);
}
// Initialize
updateClock();
setInterval(updateClock, 1000);
refresh();
setInterval(refresh, REFRESH_INTERVAL);
refreshThroughput();
setInterval(refreshThroughput, THROUGHPUT_INTERVAL);
refreshFgHealth();
setInterval(refreshFgHealth, 2 * 60 * 1000);