check_email_loop.pl problem fixed

Dave Ewall dave at notss.com
Tue Jul 19 14:26:38 CEST 2005


I found an issue with the check_email_loop.pl script that I saw one or 
two other people posting about a few months ago, so I thought I'd share.

I was using it on my mail system for a while without problems, and then 
I moved it to the new system that we set up, and it started to show lost 
emails.  I searched the mailing lists, to no avail.

The reason was that it was sending emails, and THEN checking for the 
previous email sent.  The issue comes up where it removes all of the 
emails while it's checking for the email that was sent by the previous 
run.  This assumes that it takes longer for the email that was just sent 
to get to its destination than it does for the script to then check for 
previously sent emails.

The fix is to send the email after the emails from the previous runs are 
checked, and before you flush out the state file.

I moved lines 104-116 to line 149 (in the version that was obtained by 
nagios-plugins-1.4-beta1), and the problem went away.

In the previous email system, we had two mail servers in front of the 
final destination mail server, so it took a few seconds (at best) for 
the email to propogate to its mailbox.  In the new system, there are two 
mail servers (of the same priority) that are the final destination... 
they didn't have to forward anything, and due to the faster hardware, 
the email got into the mailboxes immedately... so by sending the next 
email before checking for the previous emails, you end up deleting the 
email for the next run during the current run.

-Dave


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list