[Nagiosplug-devel] printf calls in library functions

Thomas Guyot-Sionnest dermoth at aei.ca
Sun Jul 22 19:35:17 CEST 2007

On 22/07/07 01:08 PM, Matthias Eble wrote:
> Hi list,
> we have an item in the Bugtracker (#1681516) that claims, that the 
> output for various checks is too verbose due to printf statements in 
> some library functions (for example netutils and sslutils).
> Example:
>  > ./check_http -H foo -S
>  >Name or service not known
>  >HTTP CRITICAL - Unable to open TCP socket
> I'd like to know what you think about printing to stdout/stderr in a 
> library. I see two possibilities to solve the issue:
> 1st: Always die on an error in a library (accepting the lack of the 
> plugin name string in the output.
> 2nd: Add a verbosity argument to the library functions
> Maybe both could be combined and written down in the guidelines. What do 
> you think? Btw: Why are the sslutils, etc located in the plugin directory?

How problematic is it? Nagios and NRPE doesn't care about stderr. Also
it's easy to add a 2>/dev/null when running it from another script/plug-in.

For the solutions, can't we just redirect STDERR to /dev/null when the
verbose level is 0? (That would require adding the -v switch to plugins
that don't have one yet...).


More information about the Devel mailing list