[Nagiosplug-devel] Nagios::Plugin with scientific notation

Ton Voon ton.voon at altinity.com
Mon Mar 17 10:39:33 CET 2008


Hi Nathan!

Long time no hear!

On 13 Mar 2008, at 17:19, Vonnahme, Nathan wrote:

> Larry Wall said in one of his State of the Onion speeches that it's
> better for programs (and also community members) to be "generous in  
> what
> you accept for input and strict in what you produce as output".

That's a good principle. I guess that means anything parsing the perf  
data should cater for scientific notation, but the plugins should only  
return a certain format.

In which case, what is the precision? Can we say at the time of  
printing the value, it is something like:

$value_as_text = sprintf("%.5f", $value);
$value_as_text =~ s/0+$/; # Remove trailing zeros
$value_as_text =~ s/\.$/; # Remove trailing separator

Hmmm, different languages have different separators, so do we state  
that the value will come from the POSIX locale? (decimal point is a  
dot, no 'thousands' grouping).

I'm thinking that the performance data doesn't need to be much more  
precise than this - Nagios plugin performance data is guidance, not  
exact.

Ton

http://www.altinity.com
UK: +44 (0)870 787 9243
US: +1 866 879 9184
Fax: +44 (0)845 280 1725
Skype: tonvoon





More information about the Devel mailing list