diff options
Diffstat (limited to 'web/attachments/182602-check_mailq-nullmailer.diff')
| -rw-r--r-- | web/attachments/182602-check_mailq-nullmailer.diff | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/web/attachments/182602-check_mailq-nullmailer.diff b/web/attachments/182602-check_mailq-nullmailer.diff new file mode 100644 index 0000000..f61486f --- /dev/null +++ b/web/attachments/182602-check_mailq-nullmailer.diff | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | --- check_mailq 2005-05-08 17:15:26.000000000 +0200 | ||
| 2 | +++ check_mailq 2006-06-22 16:29:57.000000000 +0200 | ||
| 3 | @@ -378,7 +378,7 @@ | ||
| 4 | # } | ||
| 5 | #} | ||
| 6 | } | ||
| 7 | -} # end of ($mailq eq "postfixl") | ||
| 8 | +} # end of ($mailq eq "postfix") | ||
| 9 | elsif ( $mailq eq "qmail" ) { | ||
| 10 | |||
| 11 | # open qmail-qstat | ||
| 12 | @@ -502,6 +502,43 @@ | ||
| 13 | } | ||
| 14 | } # end of ($mailq eq "exim") | ||
| 15 | |||
| 16 | +elsif ( $mailq eq "nullmailer" ) { | ||
| 17 | + ## open mailq | ||
| 18 | + if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
| 19 | + if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
| 20 | + print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
| 21 | + exit $ERRORS{'UNKNOWN'}; | ||
| 22 | + } | ||
| 23 | + }elsif( defined $utils::PATH_TO_MAILQ){ | ||
| 24 | + unless (-x $utils::PATH_TO_MAILQ) { | ||
| 25 | + print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; | ||
| 26 | + exit $ERRORS{'UNKNOWN'}; | ||
| 27 | + } | ||
| 28 | + } else { | ||
| 29 | + print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; | ||
| 30 | + exit $ERRORS{'UNKNOWN'}; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + while (<MAILQ>) { | ||
| 34 | + #2006-06-22 16:00:00 282 bytes | ||
| 35 | + | ||
| 36 | + if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) { | ||
| 37 | + $msg_q++ ; | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + close(MAILQ) ; | ||
| 41 | + if ($msg_q < $opt_w) { | ||
| 42 | + $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | ||
| 43 | + $state = $ERRORS{'OK'}; | ||
| 44 | + }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { | ||
| 45 | + $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; | ||
| 46 | + $state = $ERRORS{'WARNING'}; | ||
| 47 | + }else { | ||
| 48 | + $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; | ||
| 49 | + $state = $ERRORS{'CRITICAL'}; | ||
| 50 | + } | ||
| 51 | +} # end of ($mailq eq "nullmailer") | ||
| 52 | + | ||
| 53 | # Perfdata support | ||
| 54 | print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n"; | ||
| 55 | exit $state; | ||
| 56 | @@ -561,7 +598,7 @@ | ||
| 57 | } | ||
| 58 | |||
| 59 | if (defined $opt_M) { | ||
| 60 | - if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) { | ||
| 61 | + if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) { | ||
| 62 | $mailq = $opt_M ; | ||
| 63 | }elsif( $opt_M eq ''){ | ||
| 64 | $mailq = 'sendmail'; | ||
| 65 | @@ -593,7 +630,7 @@ | ||
| 66 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | ||
| 67 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | ||
| 68 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | ||
| 69 | - print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; | ||
| 70 | + print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = sendmail)\n"; | ||
| 71 | print "-h (--help)\n"; | ||
| 72 | print "-V (--version)\n"; | ||
| 73 | print "-v (--verbose) = debugging output\n"; | ||
