Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Do you know a simple script that can do email round trip monitoring ? Here a formal example :

  • I want to monitor email service on A.
  • I install the script on B.
  • B sends an email to A
  • A sends an auto-reply to B
  • B knows that email service is working well.
  • B restarts this test every 30min.
  • If B didn't received replies, it sends an alert message.
  • B could also monitor round-trip delay of emails.

The goal is to do a simple monitoring of "end to end service" (closest to the user behavior) compared to monitoring many small pieces (ping/smtp/pop3/load/...).

share|improve this question

closed as too localized by SvW, Ward, EightBitTony, Khaled, John Gardeniers Jun 6 '12 at 7:59

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

2 Answers 2

A perl, php, or powershell script is all I can think of, on a scheduler.

  • Send email
  • Check email
  • If email not received in N minutes, sound alarm

Would be neat if wormly and other services did this, but I do not think they do...

share|improve this answer
add comment

***I'm assuming the user on B can send and receive emails

On B, you need to do the following:

1) Create the file /home/user/.forward with the following:

"|/home/user/mail-handler.sh"

This script will forward emails received by B to mail-handler.sh

2) Create the file /home/user/mail-handler.sh

This will read the auto-reply email and decide whether the server is ok or not (I'm not going to write the script for this)

But an example of handling data in mail-handler.sh:

#!/bin/bash


echo  > /home/user/test.txt

while read mail_data
do
        echo $mail_data >> /home/user/test.txt
done

3) create the file mail-sender.sh, with:

echo hello |  mail -s "test" user@domain.A.com

this will send the email out to A to test if it's alive

4) Add mail-sender.sh to cron to send this every 30mins

*/30 * * * * /home/user/mail-sender.sh
share|improve this answer
    
I appreciate your answer full of details; I can easily do the rest. For my case, emails will be forwarded by A, so the main part of the test and alert would be done by B (if A crashs). –  crazyfr Jun 11 '12 at 14:36
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.