
smtp3.monitor - smtp monitor for mon with timing and logging

A SMTP monitor using IO::Socket with connection response timing and optional logging. This test is simple, as soon as the greeting banner is received from the SMTP server the monitor client closes the session with a QUIT command.

smtp3.monitor -l log_file_YYYYMM.log -t timeout_seconds -T alarm_time host host1 host2 ...


hostgroup smtp mail1.mymails.org mail2.mymails.org
mail3.mymails.org
watch smtp
service smtp_check
interval 5m
monitor smtp3.monitor -t 70 -T 30 -l /n/na1/logs/wan/smtp_YYYYMM.log
period wd {Sun-Sat}
alert mail.alert meekj@mymails.org
alertevery 1h summary

A normal log entry has the format:
measurement_time smtp_host_name connect_time
A failed connection log entry contains:
measurement_time smtp_host_name connect_time smtp_code_and_greeting (or connect_error)
Where:
measurement_time - Is the time of the connection attempt in seconds since 1970
smtp_host_name - Is the name of the smtp server that was tested
connect_time - Is the time from the connect request until the SMTP greeting appeared in seconds with 100 microsecond resolution
smtp_code_and_banner - Should have the SMTP response code integer followed by the greeting banner
connect_error - If present may indicate "Connect failed" meaning that the connect attempt failed immediately, possibly due to a DNS lookup error or because the server is not running any service on port 25. The field may also be "Connect timeout" indicating that the connect failed after the set timeout period.

A SMTP temporary failure code should cause the monitor to retry the connection.
This initial release has seen less than one day of testing.

IO::Socket Time::HiRes
If you do not have Time::HiRes you can choose to comment out the lines that refer to gettimeofday and tv_interval but several features will be lost.

Jon Meek, meekj@ieee.org