@@ -0,0 +1,153 @@
+--- monitoring-plugins-2.2/plugins-scripts/check_mailq.pl.orig 2016-11-29 09:45:08.000000000 +0100
++++ monitoring-plugins-2.2/plugins-scripts/check_mailq.pl 2016-12-22 15:40:50.192546697 +0100
+@@ -212,20 +212,20 @@
+ ## now check the queue length(s)
+
+ if ($msg_q == 0) {
+- $msg = "OK: $mailq mailq is empty";
++ $msg = "OK: mailq is empty";
+ $state = $ERRORS{'OK'};
+ } else {
+ print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
+
+ # overall queue length
+ if ($msg_q < $opt_w) {
+- $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
++ $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 mailq is $msg_q (threshold w = $opt_w)";
++ $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
+ $state = $ERRORS{'WARNING'};
+ }else {
+- $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
++ $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+ $state = $ERRORS{'CRITICAL'};
+ }
+
+@@ -357,20 +357,20 @@
+
+ # check queue length(s)
+ if ($msg_q == 0){
+- $msg = "OK: $mailq mailq reports queue is empty";
++ $msg = "OK: mailq reports queue is empty";
+ $state = $ERRORS{'OK'};
+ } else {
+ print "msg_q = $msg_q warn=$opt_w crit=$opt_c\n" if $verbose;
+
+ # overall queue length
+ if ($msg_q < $opt_w) {
+- $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
++ $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 mailq is $msg_q (threshold w = $opt_w)";
++ $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
+ $state = $ERRORS{'WARNING'};
+ }else {
+- $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
++ $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+ $state = $ERRORS{'CRITICAL'};
+ }
+
+@@ -444,13 +444,13 @@
+
+ # overall queue length
+ if ($msg_q < $opt_w) {
+- $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
++ $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 mailq is $msg_q (threshold w = $opt_w)";
++ $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
+ $state = $ERRORS{'WARNING'};
+ }else {
+- $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
++ $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+ $state = $ERRORS{'CRITICAL'};
+ }
+
+@@ -502,13 +502,13 @@
+ exit $ERRORS{CRITICAL};
+ }
+ if ($msg_q < $opt_w) {
+- $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
++ $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 mailq is $msg_q (threshold w = $opt_w)";
++ $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
+ $state = $ERRORS{'WARNING'};
+ }else {
+- $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
++ $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+ $state = $ERRORS{'CRITICAL'};
+ }
+ } # end of ($mailq eq "exim")
+@@ -539,13 +539,13 @@
+ }
+ close(MAILQ) ;
+ if ($msg_q < $opt_w) {
+- $msg = "OK: $mailq mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
++ $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 mailq is $msg_q (threshold w = $opt_w)";
++ $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
+ $state = $ERRORS{'WARNING'};
+ }else {
+- $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
++ $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+ $state = $ERRORS{'CRITICAL'};
+ }
+ } # end of ($mailq eq "nullmailer")
+@@ -619,30 +619,7 @@
+ exit $ERRORS{'UNKNOWN'};
+ }
+ }else{
+- if (defined $utils::PATH_TO_QMAIL_QSTAT
+- && -x $utils::PATH_TO_QMAIL_QSTAT)
+- {
+- $mailq = 'qmail';
+- }
+- elsif (-d '/var/lib/postfix' || -d '/var/local/lib/postfix'
+- || -e '/usr/sbin/postfix' || -e '/usr/local/sbin/postfix')
+- {
+- $mailq = 'postfix';
+- }
+- elsif (-d '/usr/lib/exim4' || -d '/usr/local/lib/exim4'
+- || -e '/usr/sbin/exim' || -e '/usr/local/sbin/exim')
+- {
+- $mailq = 'exim';
+- }
+- elsif (-d '/usr/lib/nullmailer' || -d '/usr/local/lib/nullmailer'
+- || -e '/usr/sbin/nullmailer-send'
+- || -e '/usr/local/sbin/nullmailer-send')
+- {
+- $mailq = 'nullmailer';
+- }
+- else {
+- $mailq = 'sendmail';
+- }
++ $mailq = 'sendmail' ;
+ }
+
+ return $ERRORS{'OK'};
+@@ -665,7 +642,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 ] (default = autodetect)\n";
++ print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = sendmail)\n";
+ print "-s (--sudo) = Use sudo to call the mailq command\n";
+ print "-h (--help)\n";
+ print "-V (--version)\n";
+@@ -674,8 +651,6 @@
+ print "Note: -w and -c are required arguments. -W and -C are optional.\n";
+ print " -W and -C are applied to domains listed on the queues - both FROM and TO. (sendmail)\n";
+ print " -W and -C are applied message not yet preproccessed. (qmail)\n";
+- print " This plugin tries to autodetect which mailserver you are running,\n";
+- print " you can override the autodetection with -M.\n";
+ print " This plugin uses the system mailq command (sendmail) or qmail-stat (qmail)\n";
+ print " to look at the queues. Mailq can usually only be accessed by root or \n";
+ print " a TrustedUser. You will have to set appropriate permissions for the plugin to work.\n";
|