[Nagiosplug-devel] check_qmailq

Voon, Ton Ton.Voon at egg.com
Thu Jan 8 05:55:01 CET 2004


Paul,

Any contributions are most welcome. If that means a change to utils.pm, then
if one of the project team thinks it makes sense, it will be incorporated.
So feel free to send in your patches.

I've just had a quick look at check_qmailq.pl and it looks like the
functionality has been rolled into check_mailq.pl (CVS HEAD). As I don't
know anything about qmail, could you look over check_mailq and see if your
patches still apply to this?

Ton

> -----Original Message-----
> From: Paul L. Allen [mailto:pla at softflare.com] 
> Sent: Thursday, January 08, 2004 12:56 PM
> To: nagiosplug-devel at lists.sourceforge.net
> Subject: [Nagiosplug-devel] check_qmailq
> 
> 
> I tried the check_qmailq plugin from the contrib directory 
> and found it
> somewhat lacking because the critical and warning limits are 
> hard-wired.
> So I ended up rewriting it. 
> 
> In the course of writing it I found it useful to make some changes to
> utils.pm to avoid the necessity to duplicate code.  For example, the
> current usage routine exits with an unknown status, meaning 
> that if you
> want to print the usage in the help text you essentially have 
> to do the
> same thing a different way.  With the following change, calling
> usage in void context results in the current behavior but calling it
> in scalar or array context (such as print 
> usage("Whatever\n");) results
> in it printing the usage without exiting.  It could be more efficient,
> but not without breaking the existing usage. 
> 
>    sub usage {
>      return(sprintf(shift(@_), @_)) if (defined(wantarray));
>      printf(@_);
>      exit $ERRORS{UNKNOWN};
>    } 
> 
> Another thing I found useful in avoiding inconsistencies between exit
> status and textual response was: 
> 
>    %ERROR_FLAGS = reverse(%ERRORS); 
> 
> Most perl plugins seem to determine the status code then use 
> if statements
> to work out what to print at the start of the textual response.  With
> %ERROR_FLAGS this can be simplified to: 
> 
>    print "$ERROR_FLAGS{$status} - $queue messages in queue...\n" 
> 
> I also wrote a check_range routine that (I hope) accepts a metric and
> a numeric or percentage range in all possible forms and returns true
> if the metric is OK.  It takes an optional parameter for use in
> constructing error messages about malformed ranges.  It's a bit long
> to paste here, but I'm happy to mail it if you want. 
> 
> So the question is, do you want my check_qmailq?  If so, will you
> incorporate the changes in utils.pm or should I pull them out of my
> local utils.pm and stick them directly into my check_qmailq where they
> benefit me but not others? 
> 
> -- 
> Paul Allen
> Softflare Support 
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: Perforce Software.
> Perforce is the Fast Software Configuration Management System offering
> advanced branching capabilities and atomic changes on 50+ platforms.
> Free Eval! http://www.perforce.com/perforce/loadprog.html
> _______________________________________________
> Nagiosplug-devel mailing list
> Nagiosplug-devel at lists.sourceforge.net
> 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
> 


This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.  
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.





More information about the Devel mailing list