From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/55352-check_mailq.pl.diff | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 web/attachments/55352-check_mailq.pl.diff (limited to 'web/attachments/55352-check_mailq.pl.diff') diff --git a/web/attachments/55352-check_mailq.pl.diff b/web/attachments/55352-check_mailq.pl.diff new file mode 100644 index 0000000..0af115b --- /dev/null +++ b/web/attachments/55352-check_mailq.pl.diff @@ -0,0 +1,65 @@ +--- check_mailq.pl.org 2003-07-09 15:09:26.000000000 +0200 ++++ check_mailq.pl 2003-07-09 15:06:47.000000000 +0200 +@@ -462,8 +462,43 @@ + + + } # 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 () { ++ #22m 1.7K 19aEEr-0007hx-Dy <> *** frozen *** ++ #root@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 |mailq=$msg_q\n"; +@@ -526,7 +561,7 @@ + } + + if (defined $opt_M) { +- if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) { ++ if ($opt_M =~ /sendmail|qmail|postfix|exim/) { + $mailq = $opt_M ; + }elsif( $opt_M eq ''){ + $mailq = 'sendmail'; +@@ -558,7 +593,7 @@ + print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; + 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 "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; + print "-h (--help)\n"; + print "-V (--version)\n"; + print "-v (--verbose) = debugging output\n"; -- cgit v1.2.3-74-g34f1