diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-15 15:28:35 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2003-09-15 15:28:35 (GMT) |
commit | 9328b585951a9c91cae140e93a1929591f4b4cf6 (patch) | |
tree | afe7197b214039d8dfced516876f87732f005210 /plugins-scripts/check_mailq.pl | |
parent | 5436e674db23943d991268d2adfbd83527059b8b (diff) | |
download | monitoring-plugins-9328b585951a9c91cae140e93a1929591f4b4cf6.tar.gz |
Added Exim support (768445 - Eric Bollengier)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@726 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins-scripts/check_mailq.pl')
-rwxr-xr-x | plugins-scripts/check_mailq.pl | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index 0505207..aaec251 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl | |||
@@ -462,11 +462,46 @@ elsif ( $mailq eq "qmail" ) { | |||
462 | 462 | ||
463 | 463 | ||
464 | } # end of ($mailq eq "qmail") | 464 | } # end of ($mailq eq "qmail") |
465 | elsif ( $mailq eq "exim" ) { | ||
466 | ## open mailq | ||
467 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | ||
468 | if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { | ||
469 | print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | ||
470 | exit $ERRORS{'UNKNOWN'}; | ||
471 | } | ||
472 | }elsif( defined $utils::PATH_TO_MAILQ){ | ||
473 | unless (-x $utils::PATH_TO_MAILQ) { | ||
474 | print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n"; | ||
475 | exit $ERRORS{'UNKNOWN'}; | ||
476 | } | ||
477 | } else { | ||
478 | print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n"; | ||
479 | exit $ERRORS{'UNKNOWN'}; | ||
480 | } | ||
465 | 481 | ||
482 | while (<MAILQ>) { | ||
483 | #22m 1.7K 19aEEr-0007hx-Dy <> *** frozen *** | ||
484 | #root@exlixams.glups.fr | ||
466 | 485 | ||
486 | if (/\s[\w\d]{6}-[\w\d]{6}-[\w\d]{2}\s/) { # message id 19aEEr-0007hx-Dy | ||
487 | $msg_q++ ; | ||
488 | } | ||
489 | } | ||
490 | close(MAILQ) ; | ||
491 | if ($msg_q < $opt_w) { | ||
492 | $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)"; | ||
493 | $state = $ERRORS{'OK'}; | ||
494 | }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) { | ||
495 | $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)"; | ||
496 | $state = $ERRORS{'WARNING'}; | ||
497 | }else { | ||
498 | $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)"; | ||
499 | $state = $ERRORS{'CRITICAL'}; | ||
500 | } | ||
501 | } # end of ($mailq eq "exim") | ||
467 | 502 | ||
468 | # Perfdata support | 503 | # Perfdata support |
469 | print "$msg |mailq=$msg_q\n"; | 504 | print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n"; |
470 | exit $state; | 505 | exit $state; |
471 | 506 | ||
472 | 507 | ||
@@ -526,7 +561,7 @@ sub process_arguments(){ | |||
526 | } | 561 | } |
527 | 562 | ||
528 | if (defined $opt_M) { | 563 | if (defined $opt_M) { |
529 | if ($opt_M =~ /sendmail/ || $opt_M =~ /qmail/ || $opt_M =~ /postfix/ ) { | 564 | if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) { |
530 | $mailq = $opt_M ; | 565 | $mailq = $opt_M ; |
531 | }elsif( $opt_M eq ''){ | 566 | }elsif( $opt_M eq ''){ |
532 | $mailq = 'sendmail'; | 567 | $mailq = 'sendmail'; |
@@ -542,7 +577,7 @@ sub process_arguments(){ | |||
542 | } | 577 | } |
543 | 578 | ||
544 | sub print_usage () { | 579 | sub print_usage () { |
545 | print "Usage: $PROGNAME [-w <warn>] [-c <crit>] [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; | 580 | print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; |
546 | } | 581 | } |
547 | 582 | ||
548 | sub print_help () { | 583 | sub print_help () { |
@@ -558,7 +593,7 @@ sub print_help () { | |||
558 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; | 593 | print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; |
559 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; | 594 | print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; |
560 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | 595 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; |
561 | print "-M (--mailserver) = [ sendmail | qmail | postfix ] (default = sendmail)\n"; | 596 | print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; |
562 | print "-h (--help)\n"; | 597 | print "-h (--help)\n"; |
563 | print "-V (--version)\n"; | 598 | print "-V (--version)\n"; |
564 | print "-v (--verbose) = debugging output\n"; | 599 | print "-v (--verbose) = debugging output\n"; |