[monitoring-plugins] check_mailq: add $mailq to check output, so it is ...

Jan Wagner git at monitoring-plugins.org
Thu Feb 27 21:00:08 CET 2014


    Module: monitoring-plugins
    Branch: master
    Commit: 1988e49fcecd5a502b2a6d32c212e28b17bb6d9c
    Author: Evgeni Golov <evgeni at golov.de>
 Committer: Jan Wagner <waja at cyconet.org>
      Date: Thu Feb 27 19:25:14 2014 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=1988e49

check_mailq: add $mailq to check output, so it is easily visible what was autodetected

Closes: #1242

---

 plugins-scripts/check_mailq.pl | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 2cb54b6..8293e9c 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -199,20 +199,20 @@ if ($mailq eq "sendmail") {
 	## now check the queue length(s)
 
 	if ($msg_q == 0) {
-		$msg = "OK: mailq is empty";
+		$msg = "OK: $mailq 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 ($msg_q) is below threshold ($opt_w/$opt_c)";
+			$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 is $msg_q (threshold w = $opt_w)";
+			$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
 			$state = $ERRORS{'WARNING'};
 		}else {
-			$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+			$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
 			$state = $ERRORS{'CRITICAL'};
 		}
 
@@ -344,20 +344,20 @@ elsif ( $mailq eq "postfix" ) {
 
         # check queue length(s)
         if ($msg_q == 0){
-                $msg = "OK: mailq reports queue is empty";
+                $msg = "OK: $mailq 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 ($msg_q) is below threshold ($opt_w/$opt_c)";
+                        $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 is $msg_q (threshold w = $opt_w)";
+                        $msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
                         $state = $ERRORS{'WARNING'};
                 }else {
-                        $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+                        $msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
                         $state = $ERRORS{'CRITICAL'};
                 }
 
@@ -431,13 +431,13 @@ elsif ( $mailq eq "qmail" ) {
 		
 		# overall queue length
 		if ($msg_q < $opt_w) {
-			$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
+			$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 is $msg_q (threshold w = $opt_w)";
+			$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
 			$state = $ERRORS{'WARNING'};
 		}else {
-			$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+			$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
 			$state = $ERRORS{'CRITICAL'};
 		}
 
@@ -489,13 +489,13 @@ elsif ( $mailq eq "exim" ) {
 		exit $ERRORS{CRITICAL};
 	}
 	if ($msg_q < $opt_w) {
-		$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
+		$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 is $msg_q (threshold w = $opt_w)";
+		$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
 		$state = $ERRORS{'WARNING'};
 	}else {
-		$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+		$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
 		$state = $ERRORS{'CRITICAL'};
 	}
 } # end of ($mailq eq "exim")
@@ -526,13 +526,13 @@ elsif ( $mailq eq "nullmailer" ) {
 	}
 	close(MAILQ) ;
 	if ($msg_q < $opt_w) {
-		$msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
+		$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 is $msg_q (threshold w = $opt_w)";
+		$msg = "WARNING: $mailq mailq is $msg_q (threshold w = $opt_w)";
 		$state = $ERRORS{'WARNING'};
 	}else {
-		$msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
+		$msg = "CRITICAL: $mailq mailq is $msg_q (threshold c = $opt_c)";
 		$state = $ERRORS{'CRITICAL'};
 	}
 } # end of ($mailq eq "nullmailer")



More information about the Commits mailing list