SMTP scripted monitor

Problem this snippet solves:

This scripted monitor performs a health check of an SMTP service

How to use this snippet:

Create a new file:

/usr/bin/monitors/smtp.script

Add the expect script below. Customize

@localhost to a valid email account on the servers being monitored. As dsirrine suggested, you could use a local account where the mailbox has been redirected to /dev/null.

Create a custom scripted monitor which calls the expect script:

Local Traffic >> Monitors >> Create

Type Scripted Name my_smtp_scripted_monitor File Name /usr/bin/monitors/smtp.script

Add the monitor to them SMTP monitor pool and test with the service up, down and account enabled and disabled.

If you enable debug on the scripted monitor, the output is written to:

/var/log/SCRIPTED_....log
Ex: SCRIPTED__Common_smtp_scripted_monitor.\:\:ffff\:10.1.0.100..25.log

Code :

expect 220
send "HELO localhost\r\n"
expect "250"
send "MAIL FROM: 
@localhost\r\n" expect "250" send "RCPT TO:
@localhost\r\n" expect "250" send "DATA\r\n" expect "354" send "SUBJECT:F5 LTM SMTP Health Check\r\n" send "\r\n" send "This e-mail is generated by the SMTP health check by the F5 LTM.\r\n" send ".\r\n" expect "250" send "quit\r\n" expect "221"
Published Mar 12, 2015
Version 1.0

Was this article helpful?

No CommentsBe the first to comment