[Mon-commit] mon/mon.d smtp3.monitor,1.2,1.2.2.1
Brought to you by:
trockij
From: Jim T. <tr...@us...> - 2007-06-03 20:07:23
|
Update of /cvsroot/mon/mon/mon.d In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23496/mon.d Modified Files: Tag: mon-1-2-branch smtp3.monitor Log Message: updates to smtp3.monitor from meekj Index: smtp3.monitor =================================================================== RCS file: /cvsroot/mon/mon/mon.d/smtp3.monitor,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** smtp3.monitor 15 Nov 2004 14:45:19 -0000 1.2 --- smtp3.monitor 3 Jun 2007 20:07:16 -0000 1.2.2.1 *************** *** 1,10 **** #!/usr/bin/perl ! # Yet another smtp monitor using IO::Socket with timing and logging # # $Id$ # ! # Copyright (C) 2001-2003, Jon Meek, me...@ie... # # This program is free software; you can redistribute it and/or modify --- 1,11 ---- #!/usr/bin/perl ! # Yet another smtp monitor using IO::Socket with timing, logging ! # This version looks deeper than the banner to catch milter and other problems # # $Id$ # ! # Copyright (C) 2001-2006, Jon Meek, meekj at ieee.org # # This program is free software; you can redistribute it and/or modify *************** *** 42,46 **** =head1 SYNOPSIS ! B<smtp3.monitor> [-d] [-l log_file_YYYYMM.log] [--timeout timeout_seconds] [--alarmtime alarm_time] [--mx] [--esmtp] [--requiretls] [--nofail] [--from us...@do...] [--to r1...@d1...,r2...@d2...] [--size nnnnn] [--port nn] host host1 host2 ... =head1 OPTIONS --- 43,47 ---- =head1 SYNOPSIS ! B<smtp3.monitor> [-d] [-l log_file_YYYYMM.log] [--timeout timeout_seconds] [--alarmtime alarm_time] [--maxfailtime seconds] [--mx] [--esmtp] [--requiretls] [--nofail] [--from us...@do...] [--to r1...@d1...,r2...@d2...] [--size nnnnn] [--port nn] host host1 host2 ... =head1 OPTIONS *************** *** 48,72 **** =over 5 ! =item B<-d> Debug/Diagnostic mode. Useful for manual command line use for diagnosing mail delivery problems. To determine if a mail destination will accept mail the --mx flag will useful. ! =item B<--timeout timeout> Connect timeout in seconds. ! =item B<--alarmtime alarm_timeout> Alarm if connect is successful but took ! longer than alarm_timeout seconds. =item B<-l log_file_template> /path/to/logs/smtp_YYYYMM.log Current year & month are substituted for YYYYMM, that is the only possible template at this time. ! =item B<--mx> Lookup the MX records for the domains/hosts and test ! them in preference order. The first successful test will be ! considered a success for that domain. This was originally devised for ! manual command line use as a tool to verify that mail stuck in ! outbound queues really can not be delivered. It could be used with mon ! as well, however you are usually going to want to test ALL of your ! smtp servers, not just be sure that one of them is OK. --mx applies to ! all of the domains/hosts listed on the command line. =item B<--esmtp> --- 49,89 ---- =over 5 ! =item B<-d> ! ! Debug/Diagnostic mode. Useful for manual command line use for diagnosing mail delivery problems. To determine if a mail destination will accept mail the --mx flag will useful. ! =item B<--timeout timeout> ! Connect timeout in seconds. ! ! =item B<--alarmtime alarm_timeout> ! ! Alarm if connect is successful but took longer than alarm_timeout ! seconds. ! ! =item B<--maxfailtime seconds> ! ! Alarm if connect fails only if the response time is greater than this ! value. If a Sendmail server is in REFUSE_LA, or similar, state due to ! load it will usually reject the connection in a few milliseconds. A ! typical value might be 0.050 for servers near the monitoring system. =item B<-l log_file_template> /path/to/logs/smtp_YYYYMM.log + Current year & month are substituted for YYYYMM, that is the only possible template at this time. ! =item B<--mx> ! ! Lookup the MX records for the domains/hosts and test them in ! preference order. The first successful test will be considered a ! success for that domain. This was originally devised for manual ! command line use as a tool to verify that mail stuck in outbound ! queues really can not be delivered. It could be used with mon as well, ! however you are usually going to want to test ALL of your smtp ! servers, not just be sure that one of them is OK. --mx applies to all ! of the domains/hosts listed on the command line. =item B<--esmtp> *************** *** 156,162 **** =head1 AUTHOR ! Jon Meek, me...@ie... =cut use English; use Sys::Hostname; --- 173,182 ---- =head1 AUTHOR ! Jon Meek, meekj at ieee.org ! ! $Id$ =cut + use English; use Sys::Hostname; *************** *** 177,180 **** --- 197,201 ---- 't=i' => \$TimeOut, 'alarmtime=i' => \$opt_T, + 'maxfailtime=f' => \$MaxFailTime, 'T=i' => \$opt_T, 'logfile=s' => \$opt_l, *************** *** 495,498 **** --- 516,525 ---- $ConnectTime{$host} = sprintf("-%0.4f", $dt); # Format to 100us resolution, -val if failure print " Connect to $host failed\n" if $opt_d; + if ($MaxFailTime) { + if ($dt <= $MaxFailTime) { # Don't alarm on connection refusals due to server load + $Failure = 0; + return 1; + } + } push(@Failures, $host); # Save failed host $FailureDetail{$host} = "Connect failed"; |