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.

I would like to monitor my email service installed on Server A, from end to end. Not just small pieces (ping / SMTP / POP3 / load / ...) but closer to the user behavior.

I was thinking of a script installed on a server B:

  • B sends an e-mail to A
  • A sends an automatic reply to B
  • B knows that the mail service works well.
  • This test B restarts every 30 minutes.
  • If B has not received responses, it sends an alert message.
  • B could also control round-trip propagation of e-mails.

But maybe there is better?

share|improve this question

closed as too localized by Sven, 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.

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

***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

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