Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 579 forks source link

[dev.icinga.com #6857] Run CheckCommands with C locale (workaround for comma vs dot and plugin api bug) #1859

Closed icinga-migration closed 9 years ago

icinga-migration commented 10 years ago

This issue has been migrated from Redmine: https://dev.icinga.com/issues/6857

Created by gvegidy on 2014-08-05 17:01:25 +00:00

Assignee: gbeutner Status: Resolved (closed on 2015-02-09 13:22:21 +00:00) Target Version: 2.3.0 Last Update: 2015-02-09 13:22:21 +00:00 (in Redmine)


As part of the Graphite performance data mess in #6550, #6855 and #6851 we have seen several times that the performance data returned by some checks is dependent on the locale of the system. Although the plugin specification states that this is not allowed, we should find a way to deal with plugins having these kinds of bugs in a more user friendly way.

One idea would be to set the LC_* and LANG environment variables by default to "en_US.utf8" when calling CheckCommands.

Changesets

2015-02-09 13:21:42 +00:00 by (unknown) 61684891a0c7d7fb9d6b8e0f0b4f84a2b35087ed

Set LC_NUMERIC=C for all processes on *NIX

fixes #6857

Relations:

icinga-migration commented 10 years ago

Updated by gbeutner on 2014-08-06 07:17:35 +00:00

One thing we could do is to set LC_NUMERIC to 'C':

$ LC_NUMERIC=de_DE.utf8 /usr/lib/nagios/plugins/check_ssh 127.0.0.1
SSH OK - OpenSSH_6.0p1 Debian-4+deb7u2 (protocol 2.0) | time=0,004906s;;;0,000000;10,000000
$ LC_NUMERIC=C /usr/lib/nagios/plugins/check_ssh 127.0.0.1
SSH OK - OpenSSH_6.0p1 Debian-4+deb7u2 (protocol 2.0) | time=0.004890s;;;0.000000;10.000000
icinga-migration commented 10 years ago

Updated by gbeutner on 2014-08-11 10:32:49 +00:00

icinga-migration commented 10 years ago

Updated by gbeutner on 2014-08-11 10:33:11 +00:00

icinga-migration commented 10 years ago

Updated by fmbiete on 2014-08-19 17:09:01 +00:00

I was having this problem. Setting only LC_NUMERIC=C would be safe, but setting LC_* or LANG would break a few checks for me.

But, I think the best solution would be add LC_NUMERIC=C in /etc/sysconfig/icinga2 or point to that in the documentation. Hardcode the locale for the check executions doesn't seems a flexible solution.

icinga-migration commented 10 years ago

Updated by mfriedrich on 2014-08-20 15:46:39 +00:00

Apparently the Nagios/Monitoring Plugin API specification is incorrect if the locale isn't set properly. The printf's inside the plugins will put ',' or '.' depending on thei locale violating the plugin api specification. The Monitoring Plugins project will probably fix that, but it's highly unlikely that the existing environments will install plugin updates that fast.

I'm not sure if hardcoding the LC_NUMERIC into the execution process makes much sense. Maybe it does make sense as an environment variable for all plugin check commands we ship with icinga2, and for the rest, we'll add documentation for the users to set it through the init script.

icinga-migration commented 10 years ago

Updated by mfriedrich on 2014-09-03 15:30:28 +00:00

icinga-migration commented 10 years ago

Updated by tgelf on 2014-09-10 14:30:33 +00:00

fmbiete wrote:

But, I think the best solution would be add LC_NUMERIC=C in /etc/sysconfig/icinga2

** I'd strongly opt for LC_ALL=C (or =POSIX) at startup time. It IMO makes no sense to run a localized deamon.

Setting only LC_NUMERIC=C would be safe, but setting LC_* or LANG would break a few checks for me.

Could you provide some more details here? I mean, what kind of check breaks with LC_ALL=C?

Best, Thomas

icinga-migration commented 10 years ago

Updated by fmbiete on 2014-09-11 14:21:32 +00:00

Correct me if I'm wrong, but:

If you run icinga daemon as C, I couldn't have service names or host names with non english characters, they would be stored with the idodb module wrongly, wouldn't they?

Also, although the checks are not locale sensitive, some arguments I use with them are localized, those callings will fail?

check_user_logged.pl --fullname "Francisco Miguel Biete Bañón"
icinga-migration commented 9 years ago

Updated by mfriedrich on 2015-02-09 09:56:24 +00:00

icinga-migration commented 9 years ago

Updated by mfriedrich on 2015-02-09 12:33:04 +00:00

icinga-migration commented 9 years ago

Updated by mfriedrich on 2015-02-09 12:41:27 +00:00

icinga-migration commented 9 years ago

Updated by Anonymous on 2015-02-09 13:22:21 +00:00

Applied in changeset 61684891a0c7d7fb9d6b8e0f0b4f84a2b35087ed.

icinga-migration commented 9 years ago

Updated by mfriedrich on 2015-11-04 15:59:14 +00:00