Skip to content

Commit

Permalink
Merge pull request nagios-plugins#304 from nagios-plugins/revert-290-…
Browse files Browse the repository at this point in the history
…check-mailq-opensmtpd

Revert "check_mailq: Add OpenSMTPD support" - should've been performed in maint
  • Loading branch information
hedenface authored Jul 4, 2017
2 parents dfd4089 + cdb3e13 commit 41039cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 57 deletions.
11 changes: 0 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1557,17 +1557,6 @@ else
AC_MSG_WARN([Could not find qmail-qstat or equivalent])
fi

AC_PATH_PROG(PATH_TO_SMTPCTL,smtpctl)
AC_ARG_WITH(smtpctl_command,
ACX_HELP_STRING([--with-smtpctl-command=PATH],
[sets path to smtpctl]), PATH_TO_SMTPCTL=$withval)
if test -n "$PATH_TO_SMTPCTL"
then
AC_DEFINE_UNQUOTED(PATH_TO_SMTPCTL,"$PATH_TO_SMTPCTL",[path to smtpctl])
else
AC_MSG_WARN([Could not find smtpctl or equivalent])
fi

dnl SWAP info required is amount allocated/available and amount free
dnl The plugin works through all the swap devices and adds up the total swap
dnl available.
Expand Down
48 changes: 2 additions & 46 deletions plugins-scripts/check_mailq.pl
Original file line number Diff line number Diff line change
Expand Up @@ -520,47 +520,7 @@
$state = $ERRORS{'CRITICAL'};
}
} # end of ($mailq eq "exim")
elsif ( $mailq eq "opensmtpd" ) {
## open smtpctl
if ( defined $utils::PATH_TO_SMTPCTL && -x $utils::PATH_TO_SMTPCTL ) {
if (! open (MAILQ, "$sudo $utils::PATH_TO_SMTPCTL show queue | " ) ) {
print "ERROR: could not open $utils::PATH_TO_SMTPCTL \n";
exit $ERRORS{'UNKNOWN'};
}
}elsif( defined $utils::PATH_TO_SMTPCTL){
unless (-x $utils::PATH_TO_SMTPCTL) {
print "ERROR: $utils::PATH_TO_SMTPCTL is not executable by (uid $>:gid($)))\n";
exit $ERRORS{'UNKNOWN'};
}
} else {
print "ERROR: \$utils::PATH_TO_SMTPCTL is not defined\n";
exit $ERRORS{'UNKNOWN'};
}

while (<MAILQ>) {

# 34357f5b3f589feb|inet4|mta||f.someone@domaina.org|no-reply@domainb.com|no-reply@domainb.com|1498235412|1498581012|0|25|pending|17168|Network error on destination MXs
if (/^.*|.*|.*|.*|.*|.*|.*|.*|.*|.*|.*|.*|.*|.*$/) {
$msg_q++ ;
}
}
close(MAILQ);

if ( $? ) {
print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_SMTPCTL",$/;
exit $ERRORS{CRITICAL};
}
if ($msg_q < $opt_w) {
$msg = "OK: $mailq 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 mailq is $msg_q (threshold w = $opt_w)";
$state = $ERRORS{'WARNING'};
}else {
$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
$state = $ERRORS{'CRITICAL'};
}
} # end of ($mailq eq "opensmtpd")
elsif ( $mailq eq "nullmailer" ) {
## open mailq
if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
Expand Down Expand Up @@ -658,7 +618,7 @@ ()
}

if (defined $opt_M) {
if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer|opensmtpd)$/) {
if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) {
$mailq = $opt_M ;
}elsif( $opt_M eq ''){
$mailq = 'sendmail';
Expand Down Expand Up @@ -688,10 +648,6 @@ ()
{
$mailq = 'nullmailer';
}
elsif (defined $utils::PATH_TO_SMTPCTL && -x $utils::PATH_TO_SMTPCTL)
{
$mailq = 'opensmtpd';
}
else {
$mailq = 'sendmail';
}
Expand All @@ -717,7 +673,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 | exim | nullmailer | opensmtpd ] (default = autodetect)\n";
print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n";
print "-h (--help)\n";
print "-V (--version)\n";
print "-v (--verbose) = debugging output\n";
Expand Down

0 comments on commit 41039cf

Please sign in to comment.