{"record":{"id":"c4a11239ec0a6d8e","repo":"louislam/uptime-kuma","slug":"stratum-stratum-meets-or-exceeds-threshold-st","errorCode":null,"errorMessage":"Stratum ${stratum} meets or exceeds threshold ${stratumThreshold}","messagePattern":"Stratum (.+?) meets or exceeds threshold (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/monitor-types/ntp.js","lineNumber":41,"sourceCode":"\n        const port = monitor.port || 123;\n        const timeout = (monitor.timeout || 10) * 1000;\n\n        const ntpResult = await this.queryNTP(monitor.hostname, port, timeout);\n\n        heartbeat.ping = dayjs().valueOf() - startTime;\n\n        const { stratum, offset, rootDispersion, refid, roundTripDelay } = ntpResult;\n\n        heartbeat.msg = `Stratum: ${stratum}, RefID: ${refid}, Offset: ${offset.toFixed(3)}ms, Delay: ${roundTripDelay.toFixed(3)}ms, Dispersion: ${rootDispersion.toFixed(3)}ms`;\n\n        if (stratum === 16) {\n            throw new Error(\"NTP server is unsynchronized (stratum 16)\");\n        }\n\n        const stratumThreshold = monitor.ntp_stratum_threshold || 5;\n        if (stratum >= stratumThreshold) {\n            throw new Error(`Stratum ${stratum} meets or exceeds threshold ${stratumThreshold}`);\n        }\n\n        const offsetThreshold = monitor.ntp_time_offset_threshold || 1000;\n        if (Math.abs(offset) >= offsetThreshold) {\n            throw new Error(`Time offset ${offset.toFixed(3)}ms exceeds threshold ${offsetThreshold}ms`);\n        }\n\n        const dispersionThreshold = monitor.ntp_root_dispersion_threshold || 500;\n        if (rootDispersion >= dispersionThreshold) {\n            throw new Error(\n                `Root dispersion ${rootDispersion.toFixed(3)}ms exceeds threshold ${dispersionThreshold}ms`\n            );\n        }\n\n        heartbeat.status = UP;\n    }\n\n    /**","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/ntp.js#L23-L59","documentation":"Thrown when the server's stratum is at or above monitor.ntp_stratum_threshold (default 5). Stratum counts distance from the reference clock: 1 = directly attached, 2 = one hop, etc. A higher stratum means more accumulated error, so the monitor rejects servers that are too many hops away from a reference source.","triggerScenarios":"Server returns a valid packet with stratum in [0..15] (not 16) and stratum >= stratumThreshold. E.g. querying a stratum-3 server with the default threshold of 5 will NOT fire, but raising a chain of stratum-6 servers will.","commonSituations":"Threshold left at default 5 while monitoring a deep-stratum internal server; monitoring a public server whose stratum drifted up; policy requires a tighter stratum than the default.","solutions":["Raise monitor.ntp_stratum_threshold to a value the legitimate target stays under (e.g. 8 or 10).","Point the monitor at a closer NTP source (lower stratum) — a local stratum-2 instead of a distant stratum-6.","Confirm the target's own upstreams are healthy so its advertised stratum stays low."],"exampleFix":"// before: monitor.ntp_stratum_threshold = 5  (target is stratum 6)\n// after:  monitor.ntp_stratum_threshold = 8","handlingStrategy":"validation","validationCode":"function validateStratumThreshold(monitor) {\n  const t = Number(monitor.ntp_stratum_threshold ?? 5);\n  if (!Number.isFinite(t) || t < 2 || t > 15) throw new Error('ntp_stratum_threshold must be 2..15');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set ntp_stratum_threshold above the target's normal stratum (observe with ntpq -p).","Remember stratum 16 is a hard failure handled separately and cannot be allowed by this threshold.","Use a closer NTP source if the target persistently reports a deep stratum."],"tags":["ntp","threshold","config","uptime-kuma"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}