My MVP Profile

Sunday, December 24, 2006

Day 11 - Checking SMTP Gateway Health

On the 11th day of Christmas, here's a script we use that's good for moving beyond the simple port check. This script connects to your SMTP gateway and then performs a string comparison against the server response data to determine service health. Really, this script could be modified to perform a check against any number of TCP-based services. This particular example is hard coded to port 25 to perform an SMTP check.

 

How it works:

This example functions as follows:

  1. Performs a telnet to port 25 on a given IP or hostname (as provided in Host script parameter).
  2. Once connection is made, passes a command (provided in the Command script parameter). We use a simple EHLO command.
  3. Then performs a comparison of the data returned to user-defined search string (in SearchString script parameter). We check for the 250-response code ("250- mail.mydomain.com Hello [10.10.10.10]"). Simply telnet to your SMTP server on port 25 and issue and EHLO to get this value.

 

PARAMETERS: 

Host - A single host NetBIOS, FQDN and IP okay

Command - Send a command to the SMTP service on the server. If this command is left blank, then a simple port will run instead.

SearchString - A search string will be used when a command is sent to the STMP server, otherwise this is ignored.   

LogSuccessEvent - 1 - log successful events, 0 - logs failure events

 

 

NOTE: that this script uses the FREE Toolsack Baseline COM objects which can be downloaded for free from http://www.arcticlabs.com. It comes as a Windows installer package (.msi). installation is a couple of clicks and has been stable everywhere I've used it.

 

WHERE TO GET IT:

The SMTP Health Check Script can be downloaded at the URL below.

http://www.momresources.org/momscripts/smtp_health_check.txt

 

Comments on "Day 11 - Checking SMTP Gateway Health"

 

post a comment links to this post