Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 105755 - nagios-plugins-1.4 incorrectly handles locale
Summary: nagios-plugins-1.4 incorrectly handles locale
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Netmon project
URL: https://sourceforge.net/tracker/?func...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-12 18:50 UTC by Michal Margula
Modified: 2006-04-01 14:15 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
nagios-plugins-1.4.ebuild.patch (nagios.patch,769 bytes, patch)
2005-09-13 06:50 UTC, Lance Albertson (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Margula 2005-09-12 18:50:56 UTC
After upgrading nagios-plugins to 1.4 I encountered some trouble. It incorretly
handles locales, so can't properly parse ping output (and probably output from
/proc/loadavg also). Solution is to upgrade to 1.4.1 ASAP.
Comment 1 Lance Albertson (RETIRED) gentoo-dev 2005-09-13 05:47:04 UTC
I see whats going on. I need to add a nls use flag and configure option to the
ebuild. I'll do that this morning if I've got time. Thanks for pointing that out!
Comment 2 Lance Albertson (RETIRED) gentoo-dev 2005-09-13 06:50:08 UTC
Created attachment 68359 [details, diff]
nagios-plugins-1.4.ebuild.patch

Can you try this patch and enable the nls use flag? Let me know if this works,
thanks!
Comment 3 Michal Margula 2005-09-20 15:22:04 UTC
Sorry for the delay. Unfortunately patch doesn't help. 

Still:

gollum nagios-plugins # /usr/nagios/libexec/check_ping  -H 127.0.0.1 -w 30,1% -c
50,10%
/bin/ping -n -U -w 10 -c 5 127.0.0.1
CRITICAL - Could not interpret output from ping command
Comment 4 Lance Albertson (RETIRED) gentoo-dev 2005-09-20 16:07:15 UTC
Does the solution provided in the sourceforge tracker fix the problem?

Namely:

====

the problem seems to be in the parsing with scanf that when
you are in locale that have the comma as decimal separator
the scanf fail.

I fixed replacing in all plugin that i nedd the line

  setlocale (LC_ALL, "");

with

  setlocale (LC_ALL, "C");

all now work fine!
Comment 5 Michal Margula 2005-09-20 16:27:32 UTC
And that is why upgrading to 1.4.1 is good solution, because it contains such
fix :).
Comment 6 Lance Albertson (RETIRED) gentoo-dev 2005-09-20 22:36:32 UTC
If thats the case, I'd like to wait a few more works to make sure 1.4.1 doesn't
have more bugs in it. I did a few cleanups in the ebuild for that and wouldn't
like any issues creep up without waiting a bit. For now, you can just keyword
that ebuild until I feel more comfortable bumping 1.4.1 to stable.
Comment 7 Michal Margula 2005-09-21 07:28:45 UTC
OK. If it helps - nagios-plugins-1.4.1 works OK for over a week, checking about
300 services on over 100 hosts.
Comment 8 Fabio Coatti 2005-10-04 03:25:56 UTC
The same applies to check_procs.c, it fails to count processes (option -C).
It can be fixed with 
setlocale (LC_NUMERIC, "C");
after 
setlocale (LC_ALL, "");

Maybe there are several other plugins that have the same problem.

Comment 9 Wolf Giesen (RETIRED) gentoo-dev 2005-12-15 21:25:12 UTC
I suggest not using check_ping, but check_icmp instead. It's widely known
(upstream) that check_ping has those troubles.
Comment 10 Lance Albertson (RETIRED) gentoo-dev 2006-04-01 14:15:15 UTC
This issue should be fixed in the latest stable version. Closing.