Forum Discussion
dsirrine_23403
Feb 07, 2011Nimbostratus
Custom monitor for SMTP servers
I have dug through some of the forums and have yet to find the solution I'm looking for. I have a set of load balanced SMTP servers in my LTM with version 9.3.1 software installed. I have the SMTP health check enabled, however, it doesn't do exactly what I would like it to do. For example, I would like the F5, as part of the health check, to send an actual e-mail to the SMTP server and monitor the response to determine if the e-mail was successful or failed. I recently had an issue where /var on one of the systems filled up, and while the server was still responding to SMTP requests as one would expect, it was failing to accept any e-mails due to the drive being full. I would like the check to disable a node if it fails to receive an e-mail. If you could point me in the right direction, it would be greatly appreciated. Thank you in advance.
- Chris_MillerAltostratusInteresting. So, you'd basically like the check to connect to the server, issue a helo, a mail from, an rcpt to, and if it sees "queued for delivery" or whatever, consider it up? Does your mail server have any sort of spam protection which would limit the amount of connections from a single IP?
- hooleylistCirrostratus
You could potentially do this with a scripted monitor using expect. Or if that doesn't work, an external monitor calling a shell script should do it.
Aaron
- dsirrine_23403Nimbostratus@Chris. That's exactly what I'm trying to accomplish. While knowing port 25 is listening is nice and important, I need to also determine if the server is accepting mail. I'm looking to ensure I get a 250 response code essentially.
- dsirrine_23403NimbostratusI think I can do this with the send/expect. However, how can I set a variable to be the IP of the node that is running the check. For instance, I have two SMTP servers in my LTM, I create the expect to be something like the following:
- dsirrine_23403Nimbostratuswhoops. It did some code cleaning. there should be ip_address between telnet and 25 as well as after ehlo. And email_address after from and to
- dsirrine_23403NimbostratusI got it to work. I didn't need the initial "send telnet" as the scripted monitor does that to begin with. Unfortunately, I can't use pop/imap/etc as this is to test an exim gateway and can't necessarily "retrieve" the e-mail from the impacted system. doing an "ehlo" on localhost rounds it out nicely. Here's what I ended with:
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"
= a local account that the mailbox has been redirected to /dev/null. If /var is full, I get an error of not being able to write to spooler, otherwise, I get a 250 OK. - hooleylistCirrostratusThanks for the solution dsirrine. I added it to the Codeshare here:
- TechgeeegNimbostratusHi,
- hooleylistCirrostratusHi Techgeeg,
- Torsten_93742Nimbostratus
Hi, the links in this post are outdated:
External monitor template: https://devcentral.f5.com/wiki/AdvDesignConfig.TemplateForExternalLtmMonitors.ashx
SMTP monitor at Codeshare: https://devcentral.f5.com/wiki/AdvDesignConfig.SMTP_scripted_monitor.ashx
Cheers, Torsten
Recent Discussions
Related Content
Â
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects