diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-07-05 13:45:57 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-07-05 13:45:57 +0000 |
commit | 5f9761ed60091476d9e86bbb0e306776c0823fcb (patch) | |
tree | 960b917e19fc01a19eb205f49391256d2bf00e22 /plugins-scripts | |
parent | 4240aba33f68bf8f9882023c952abf13b7a12f5b (diff) | |
download | monitoring-plugins-5f9761ed60091476d9e86bbb0e306776c0823fcb.tar.gz |
Fixed checking of return codes from external mailq programs
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1443 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_mailq.pl | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index f1aec0f4..c676e41a 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl | |||
@@ -186,12 +186,10 @@ if ($mailq eq "sendmail") { | |||
186 | ## close mailq | 186 | ## close mailq |
187 | 187 | ||
188 | close (MAILQ); | 188 | close (MAILQ); |
189 | # declare an error if we also get a non-zero return code from mailq | 189 | |
190 | # unless already set to critical | ||
191 | if ( $? ) { | 190 | if ( $? ) { |
192 | $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; | 191 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; |
193 | print "STDERR $?: $!\n" if $verbose; | 192 | exit $ERRORS{CRITICAL}; |
194 | $msg = "$state: (stderr)\n"; | ||
195 | } | 193 | } |
196 | 194 | ||
197 | ## shut off the alarm | 195 | ## shut off the alarm |
@@ -318,12 +316,10 @@ elsif ( $mailq eq "postfix" ) { | |||
318 | 316 | ||
319 | # close qmail-qstat | 317 | # close qmail-qstat |
320 | close MAILQ; | 318 | close MAILQ; |
321 | # declare an error if we also get a non-zero return code from mailq | 319 | |
322 | # unless already set to critical | ||
323 | if ( $? ) { | 320 | if ( $? ) { |
324 | $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; | 321 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; |
325 | print "STDERR $?: $!\n" if $verbose; | 322 | exit $ERRORS{CRITICAL}; |
326 | $msg = "$state: (stderr)\n"; | ||
327 | } | 323 | } |
328 | 324 | ||
329 | ## shut off the alarm | 325 | ## shut off the alarm |
@@ -401,12 +397,10 @@ elsif ( $mailq eq "qmail" ) { | |||
401 | 397 | ||
402 | # close qmail-qstat | 398 | # close qmail-qstat |
403 | close MAILQ; | 399 | close MAILQ; |
404 | # declare an error if we also get a non-zero return code from mailq | 400 | |
405 | # unless already set to critical | ||
406 | if ( $? ) { | 401 | if ( $? ) { |
407 | $state = $state == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"WARNING"} ; | 402 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; |
408 | print "STDERR $?: $!\n" if $verbose; | 403 | exit $ERRORS{CRITICAL}; |
409 | $msg = "$state: (stderr)\n"; | ||
410 | } | 404 | } |
411 | 405 | ||
412 | ## shut off the alarm | 406 | ## shut off the alarm |
@@ -490,6 +484,11 @@ elsif ( $mailq eq "exim" ) { | |||
490 | } | 484 | } |
491 | } | 485 | } |
492 | close(MAILQ) ; | 486 | close(MAILQ) ; |
487 | |||
488 | if ( $? ) { | ||
489 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; | ||
490 | exit $ERRORS{CRITICAL}; | ||
491 | } | ||
493 | if ($msg_q < $opt_w) { | 492 | if ($msg_q < $opt_w) { |
494 | $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | 493 | $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; |
495 | $state = $ERRORS{'OK'}; | 494 | $state = $ERRORS{'OK'}; |