[Nagiosplug-devel] Problems with locales on Nagios 2 beta

Ben Clewett ben at clewett.org.uk
Mon Feb 28 06:22:16 CET 2005

Hi Pedro,

I have experienced the same with the performance data.  Eg, check_nt.  I 
posted about this, but used wrong email so my posting has gone somewhere....

This is pertinent to performance data where a '0,00' format is illegal 
and will be at worse dropped or at best truncated to an integer.

My suggestion is one we use successfully in PerfParse.  Encase the line 
of the program which writes the data in the commands:

	setlocale(LC_NUMERIC, "POSIX");
	setlocale(LC_NUMERIC, "");

Eg, in the bugged check_nt use:

	setlocale(LC_NUMERIC, "POSIX");
	asprintf(&temp_string_perf,_("'%s:\\ Used Space'=%.2fGb;%.2f;%.2f
;0.00;%.2f"), ... );
	setlocale(LC_NUMERIC, "");

This will allow the man-readable section to appear locale correct, and 
the performance data to be legally correct.  Eg:

OK, temperature = 23,23 Deg C | temp=23.23degc

I am sorry I do not currently have time to write a patch against the 
current release of plugins, but hope this is of some use.


pedro wrote:
> Hi all!
> I have recently upgraded to Nagios 2 beta and found a problem between
> the plugins and the system locale. If the system locale is set to
> something other than english, most plugins give an error while parsing
> the results of their probes. Plugins give an error that Nagios
> interprets as if the checked service is down, which brings more
> confusion. Such case happens with check_ping, for example. The situation
> may not be immediately obvious for some, as, at machine boot everything
> seems to run fine (system locale is reset only after the load of nagios,
> at least on Mandrake 10.1). But later, any reload or restart of nagios
> daemon brings trouble. 
> The present solution is to give nagios an english locale either through
> ~/.i18n or to bring /etc/sysconfig/i18n to english (this concerns
> Mandrake distros). 
> Regards
> Pedro Rosa
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________________
> Nagios Plugin Development Mailing List Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null

More information about the Devel mailing list