Skip to content

fix check_ntp_offset on French Windows (w32tm parsing) - #494

Open
k9fr4n wants to merge 1 commit into
ConSol-Monitoring:mainfrom
k9fr4n:fix/224-ntp-offset-french-windows
Open

k9fr4n wants to merge 1 commit into
ConSol-Monitoring:mainfrom
k9fr4n:fix/224-ntp-offset-french-windows

Conversation

@k9fr4n

@k9fr4n k9fr4n commented Nov 9, 2026

Copy link
Copy Markdown

Fixes #224.

On French Windows, check_ntp_offset always reported:

CRITICAL - w32tm.exe: Erreur lors de la dernière synchronisation: 0 (...)

even when the clock was fine.

Root cause: the w32tm output parser split each line with a quote-aware
tokenizer. French key names contain apostrophes before the colon
(Ordinateur d'état :, Fréquence d'horloge :, ...), so those lines were
silently dropped and the positional fallback parser read the wrong
lines — attributes[11] ended up being the "Last Sync Error" line
instead of the state machine.

This change splits w32tm lines on the first colon without quote handling
(new splitW32Line helper, used by both parsers) and adds a test case
with real output captured from a French Windows Server 2025.

Checked against the real French output: without the fix the test shows
the exact bogus message from the issue, with the fix the check reports
the state machine line as it should.

w32tm output parsing used quote-aware tokenizing, so French key
names with apostrophes (Ordinateur d'etat, Fréquence d'horloge, ...)
were dropped and positional parsing read the wrong lines.

Split w32tm lines on the first colon instead and add a real French
Windows Server 2025 output as test case.

Fixes ConSol-Monitoring#224
@sni

sni commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Thanks, but we are working on a general solution already in
#489
That should make ntp checks independent of any locales.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG REPORT: check_ntp_offset on Windows with french language

2 participants