[Nagiosplug-devel] RFC: New threshold syntax

Max perldork at webwizarddesign.com
Thu Mar 20 13:31:54 CET 2008


>  Well, if you want something like that why not making it like my
>  suggestion which:
>
>  1. is a bit clearer: just like your example but using name=value pairs
>  instead of values alone
>  2. Is a standard way of specifying parameters, and is parseable using
>  standard libraries.

>  Well, if you want something like that why not making it like my
>  suggestion which:
>
>  1. is a bit clearer: just like your example but using name=value pairs
>  instead of values alone
>  2. Is a standard way of specifying parameters, and is parseable using
>  standard libraries.

--threshold name=cpu,type=warn,min=0,max=80,inside

uom_prefix=Ki,uom=b

This certainly is very readable, is there a need for uom or
uom_prefix?  Isn't it as maintainable to use suffixes on min and max
to ask for types and a little less typing

Instead of

--threshold name=cpu,type=warn,min=0,max=80,oum_prefix=Ki,uom=b

We get

--threshold name=cpu,type=warn,min=0KB,max=80,gt

If min or max specifies a suffix, that becomes the type .. if both
specify suffixes that don't match, throw an error

The thing I like about using --warning and --critical still is that
the focus of a threshold is what kind of alert it will trigger as that
is the focus of a threshold, yes? :)  using that and integrating your
style we would get

--warning name=system,max=90 --warning name=nice,max=99 --critical
name=system,max=100

and if we use the threshold type as the argument then we can eliminate
the name= part and get

--warning system,max=90 --critical user,max=95

which can then lead to complex conditionals if needed, still easy to parse

--warning system,max=80,min=0,range=inside,AND,user,max=80 --critical
system,max=98,OR,user,max=98

If UOM is assumed to be at the end of a min or max (if both are
specified and do not match, the library would throw an error) then we
reduce the fields needed.

and this way the only time a condition type has to be specified is
when a min and max are present

this is all still much more verbose than just using RPN :), parsing
RPN is a simple matter and there are lots of libraries available to do
that

--warning system,90,gt,nice,90,gt,AND

To me the RPN style is easy to read and minimizes typing and the
specification is simple

SPEC = THRESHOLD1,THRESHOLDN,boolean
THRESHOLD = metric,number[uom],[number[uom]],conditional

Another idea is to not use RPN but a similar style

--warning system,gt,90

--warning system,gt,90,AND,user,gt,90

Similar style and gets rid of the RPN while avoiding special
characters that could be misinterpreted by shells, including spaces

- Max




More information about the Devel mailing list