#531716 nagios-plugins-basic: Results of check_ntp* tests depend on locale

#531716#5
Date:
2009-06-03 13:27:48 UTC
From:
To:
Hi!

It seems that the results of the ntp checks depend on the used locale:


=========================================
root@longinus:~# locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

root@longinus:~# /usr/lib/nagios/plugins/check_ntp_peer -H localhost -w 0.5 -c 1
NTP WARNING: Offset 0,014 secs|offset=0,014000s;0,000000;1,000000;

root@longinus:~# LANG=POSIX /usr/lib/nagios/plugins/check_ntp_peer -H localhost -w 0.5 -c 1
NTP OK: Offset 0.014145 secs|offset=0.014145s;0.500000;1.000000;
===========================================

Note that the values didn't change much, but the german locale uses a
"," to sepperate decimal values instead of a dot.


(Causes especially funny results, if you invoke the test via nrpe and
the locale settings of the user starting nrpe influence the results of
this test...)


Best regards,
  Alexander

#531716#10
Date:
2009-06-14 10:52:04 UTC
From:
To:
forcemerge 509359 531716
thanks


Hi Alexander,

Looks like the same problem as in #509359.

With kind regards, Jan.

#531716#15
Date:
2009-08-14 03:09:40 UTC
From:
To:
This bug is invalid.

The locale also affects input data. By passing a fractional number using
a dot (0.5), the function that converts it from string to the internal C
 type "double" stops reading at the first non-numeric character (dot) as
it expects commas as the decimal separator. The end result is the
warning parameter end up being 0.
warning threshold appears as 0 in the warning case.