51eb3bf7c8
- 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>
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
import { createConnection } from "net";
|
|
|
|
export const name = "Internet";
|
|
export const url = null;
|
|
|
|
// TCP connect to Google DNS port 53 — more reliable than ICMP ping in
|
|
// managed Windows environments where outbound ICMP may be blocked.
|
|
const CHECK_HOST = "8.8.8.8";
|
|
const CHECK_PORT = 53;
|
|
const TIMEOUT_MS = 5000;
|
|
|
|
function tcpCheck(host, port) {
|
|
return new Promise((resolve) => {
|
|
const start = Date.now();
|
|
const socket = createConnection({ host, port }, () => {
|
|
const latencyMs = Date.now() - start;
|
|
socket.destroy();
|
|
resolve({ reachable: true, latencyMs });
|
|
});
|
|
socket.setTimeout(TIMEOUT_MS);
|
|
socket.on("timeout", () => { socket.destroy(); resolve({ reachable: false, latencyMs: null }); });
|
|
socket.on("error", () => { resolve({ reachable: false, latencyMs: null }); });
|
|
});
|
|
}
|
|
|
|
export async function checkStatus() {
|
|
const { reachable, latencyMs } = await tcpCheck(CHECK_HOST, CHECK_PORT);
|
|
|
|
if (!reachable) {
|
|
return {
|
|
name,
|
|
status: "outage",
|
|
message: `No response from ${CHECK_HOST}:${CHECK_PORT} — internet may be down.`,
|
|
lastUpdated: new Date().toISOString(),
|
|
};
|
|
}
|
|
|
|
const status = latencyMs >= 100 ? "degraded" : "operational";
|
|
const message = latencyMs >= 100
|
|
? `High latency to ${CHECK_HOST}: ${latencyMs}ms.`
|
|
: `Internet reachable — ${CHECK_HOST} responded in ${latencyMs}ms.`;
|
|
|
|
return {
|
|
name,
|
|
status,
|
|
message,
|
|
lastUpdated: new Date().toISOString(),
|
|
};
|
|
}
|