diff options
| author | batsumaru <> | 2026-07-01 18:35:27 +0900 |
|---|---|---|
| committer | batsumaru <> | 2026-07-01 18:35:27 +0900 |
| commit | 958dfa35fd030e5b609298b1236692c85b6ffafc (patch) | |
| tree | c1dd2998a216c4105eeb6f61de5106a1e8eb19d4 /statuspage/checks/ntpd.sh | |
| parent | f3f4d8bcde122a711000bb79c4a30f1edd9874ff (diff) | |
Fix clock offset extraction dropping positive values
ntpq's "rv 0 offset" prefixes non-negative offsets with an explicit
"+" (e.g. "offset=+0.030208"), which wasn't in the sed capture class
([-0-9.]). Since the capture group is starred, the regex still
"matched" with an empty capture instead of failing outright, silently
producing "no response" for every positive/zero offset while negative
ones (which do use "-", already in the class) worked fine. Confirmed
against the real box: earlier renders with negative drift worked,
then it started showing "no response" once the drift crossed zero.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'statuspage/checks/ntpd.sh')
| -rwxr-xr-x | statuspage/checks/ntpd.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/statuspage/checks/ntpd.sh b/statuspage/checks/ntpd.sh index 1770dc8..c95807b 100755 --- a/statuspage/checks/ntpd.sh +++ b/statuspage/checks/ntpd.sh @@ -16,7 +16,7 @@ if [ "$NTPD_STATUS" != "ok" ]; then exit 0 fi -RAW=$(ntpq -c "rv 0 offset" 2>/dev/null | sed -n 's/.*offset=\([-0-9.]*\).*/\1/p') +RAW=$(ntpq -c "rv 0 offset" 2>/dev/null | sed -n 's/.*offset=\([-+0-9.]*\).*/\1/p') if [ -z "$RAW" ]; then json_line "host services" "clock offset" "no response" "warn" |
