[Nagiosplug-devel] Nagios:Plugin feedback
Andreas Ericsson
ae at op5.se
Fri Jan 19 14:55:39 CET 2007
Thomas Guyot-Sionnest wrote:
> On 19/01/07 04:05 AM, Ton Voon wrote:
>> On 19 Jan 2007, at 03:46, Gavin Carr wrote:
>>
>>>> Is there a is_hostname function? is_ipaddr would be useful as well.
>>>>
>>>> What about passing argument check code directly in the add_arg()
>>>> arguments?
>>>>
>>>>
>>> My feeling is that we wouldn't add datatype stuff to Nagios::Plugin,
>>>
>>> largely because it's pretty well covered already in other CPAN modules.
>>>
>> Agreed. CPAN is about reusing other bits of code. However, some pointers
>> to "good implementations" in CPAN might be helpful.
>>
>> Longer term, we probably need to think about how to handle module
>> dependencies for a given check_* script. Distributing a plugin to 100
>> boxes might prove problematic if there is a large list of dependencies.
>
> There's many useful functions in the C API for Nagios plugins. I believe
> it wouldn't be a bad idea to have the same kind of function directly
> into Nagios::Plugin. By minimizing the use of external modules, you
> simplify plugin deployment.
>
> Nagios::Plugin could itself load external modules to do the checks, but
> those dependencies would be installed along with Nagios::Plugin.
>
> What I'm starting to realize is that there's nothing to check the
> validity of arguments. In C you have all those functions:
>
> is_integer
> is_intpos
> is_intneg
> is_intnonneg
> is_intpercent
> is_numeric
> is_positive
> is_negative
> is_nonnegative
> is_percentage
>
Please, pretty please, don't mention those. They are extremely bad examples
of C programming. ALL of them can, even from the callers perspective
be replaced with shorter versions that are already C89 compliant.
Most of them also duplicate checks already implemented in the libc functions
and *NONE* of them return the computed value to the caller. Each time you see
one of those functions used, you will know for a fact that several operations
are carried out at least twice. It's usually worse than that, because it's often
done in subtly (and pointless) different ways that the compiler can't optimize
away.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
More information about the Devel
mailing list