Forum Discussion
dsirrine_23403
Feb 24, 2011Nimbostratus
Custom Monitor EAV with Send/Expect script
I am having an issue with my custom monitor where I am attempting to send an e-mail via telnet on port 25 using the send/expect scripted monitor. What I have so far is the following:
send telnet =IP= 25\r\n
expect 220
send HELO =IP=\r\n
expect 250
send MAIL FROM: =email=\r\n
expect 250
send RCPT TO: =email=\r\n
expect 250
send DATA\r\n
expect 354
send SUBJECT:This is a test\r\n
send \r\n
send Test\r\n
send .\r\n
expect 250
send quit\r\n
When it sends the telnet *ip* 25, it recieves the 220 ok, however, it then doesn't ignore the rest of the header lines. Is there a method to use regex or a pause statement that I can use to solve this issue in this expect script? Thank you in advance.
4 Replies
Sort By
- I'm not sure whether you can just expect for 250.
- Hi dsirrine,
- I 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: address@localhost\r\n" expect "250" send "RCPT TO: address@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. - Hi dsirrine,
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