[Nagiosplug-checkins] CVS: nagiosplug/plugins-scripts check_mailq.pl,1.3,1.4
Ton Voon
tonvoon at users.sourceforge.net
Mon Sep 15 08:29:08 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins-scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv22574/plugins-scripts
Modified Files:
check_mailq.pl
Log Message:
Added Exim support (768445 - Eric Bollengier)
Index: check_mailq.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins-scripts/check_mailq.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** check_mailq.pl 14 May 2003 21:59:53 -0000 1.3
--- check_mailq.pl 15 Sep 2003 15:28:35 -0000 1.4
***************
*** 463,471 ****
} # end of ($mailq eq "qmail")
!
# Perfdata support
! print "$msg |mailq=$msg_q\n";
exit $state;
--- 463,506 ----
} # end of ($mailq eq "qmail")
+ elsif ( $mailq eq "exim" ) {
+ ## open mailq
+ if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
+ if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
+ print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
+ exit $ERRORS{'UNKNOWN'};
+ }
+ }elsif( defined $utils::PATH_TO_MAILQ){
+ unless (-x $utils::PATH_TO_MAILQ) {
+ print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
+ exit $ERRORS{'UNKNOWN'};
+ }
+ } else {
+ print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
+ exit $ERRORS{'UNKNOWN'};
+ }
! while (<MAILQ>) {
! #22m 1.7K 19aEEr-0007hx-Dy <> *** frozen ***
! #root at exlixams.glups.fr
!
! if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy
! $msg_q++ ;
! }
! }
! close(MAILQ) ;
! if ($msg_q < $opt_w) {
! $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
! $state = $ERRORS{'OK'};
! }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
! $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
! $state = $ERRORS{'WARNING'};
! }else {
! $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
! $state = $ERRORS{'CRITICAL'};
! }
! } # end of ($mailq eq "exim")
# Perfdata support
! print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
exit $state;
***************
*** 527,531 ****
if (defined $opt_M) {
! if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) {
$mailq = $opt_M ;
}elsif( $opt_M eq ''){
--- 562,566 ----
if (defined $opt_M) {
! if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) {
$mailq = $opt_M ;
}elsif( $opt_M eq ''){
***************
*** 543,547 ****
sub print_usage () {
! print "Usage: $PROGNAME [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
}
--- 578,582 ----
sub print_usage () {
! print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n";
}
***************
*** 559,563 ****
print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
! print "-M (--mailserver) = [ sendmail | qmail | postfix ] (default = sendmail)\n";
print "-h (--help)\n";
print "-V (--version)\n";
--- 594,598 ----
print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
! print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n";
print "-h (--help)\n";
print "-V (--version)\n";
More information about the Commits
mailing list