@@ -0,0 +1,157 @@
+--- nagios-plugins-2.4.0/plugins-scripts/check_mailq.pl.orig 2020-06-11 22:34:44.000000000 +0200
++++ nagios-plugins-2.4.0/plugins-scripts/check_mailq.pl 2022-10-08 23:51:22.065399871 +0200
+@@ -221,20 +221,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'};
+ }
+
+@@ -371,20 +371,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'};
+ }
+
+@@ -458,13 +458,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'};
+ }
+
+@@ -516,13 +516,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")
+@@ -593,13 +593,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")
+@@ -707,34 +707,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';
+- }
+- elsif (defined $utils::PATH_TO_SMTPCTL && -x $utils::PATH_TO_SMTPCTL)
+- {
+- $mailq = 'opensmtpd';
+- }
+- else {
+- $mailq = 'sendmail';
+- }
++ $mailq = 'sendmail';
+ }
+
+ return $ERRORS{'OK'};
+@@ -757,7 +730,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 | opensmtpd ] (default = sendmail)\n";
+ print "-h (--help)\n";
+ print "-V (--version)\n";
+ print "-v (--verbose) = debugging output\n";
+@@ -765,8 +738,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";
|