Free Software

Back to resources.
Back to web site.

deliverytimes.pl - MRTG script to display average mail delivery delay.

v.1.0 - 10/19/2003

Send a notice to this e-mail address when software is updated:

Overview

This script will display an average of the mail delivery delay for messages disposed of within the last X minutes, where X is your MRTG interval. It will give you an average delivery delay for non-spam, and another for spam. The average is displayed in seconds.

Operation:

  1. Determine the Message IDs of all messages with "Stat=Sent" in the log for the given interval. This indicates the message has been disposed of.
  2. Look back to see when each Message ID was received and compute the distance in seconds.
  3. If a MailScanner log line is found for the Message ID that indicates the message was Spam, it is recorded as such. Otherwise it is "non spam".
  4. Average delay for Spam and non-spam outputted.

Note: This was written for Sendmail style logs. If a postfix user wants to send me some sample log lines, I'll include support...

Downloading

The perl script can be found here. Refer to the next section for configuration information.

deliverytimes.pl  (v1.0 - 5.5k)

Implementation

Modify the interval line in the deiverytimes.pl file if you're not on a 5 minute interval with MRTG.

$IntMins = "5";   # Set this to your MRTG interval

Place the deliverytimes.pl file wherever you like to keep your MRTG scripts. Add a similar entry to your mrtg.cfg file:

# Mail Delivery Times
Target[delivery]: `/usr/local/mrtg-2/bin/deliverytimes.pl`
Title[delivery]: Mail Delivery Time
PageTop[delivery]: <H1>Mail Delivery Time</H1>
XSize[delivery]: 360
YSize[delivery]: 75
Kilo[delivery]: 60
kMG[delivery]: s,m,hr
MaxBytes[delivery]: 100000
YLegend[delivery]: Time
ShortLegend[delivery]:
Options[delivery]: growright,nopercent,gauge
Legend1[delivery]: Non-Spam Delivery Time
Legend2[delivery]: Spam Delivery Time
LegendI[delivery]: &nbsp;Non-Spam Delivery Time&nbsp;
LegendO[delivery]: &nbsp;Spam Delivery Time&nbsp;
Colours[delivery]: DKBLUE#61A0DF,DKBLUE#0000DD,BLUE#003366,BLUE#000044

Sample Graphs

Here are some sample graphs. (Take note of the big drop in delivery time on Tuesday morning. This was a result of an upgrade from Spam Assassin 2.55 to 2.60-1. Pretty obvious performance improvement!!)


`Daily' Graph (5 Minute Average)
day
Max  Non-Spam Delivery Time   181.0 s time Average  Non-Spam Delivery Time   5.0 s time Current  Non-Spam Delivery Time   1.0 s time
Max  Spam Delivery Time   18.0 s time Average  Spam Delivery Time   4.0 s time Current  Spam Delivery Time   2.0 s time

`Weekly' Graph (30 Minute Average)
week
Max  Non-Spam Delivery Time   54.0 s time Average  Non-Spam Delivery Time   7.0 s time Current  Non-Spam Delivery Time   3.0 s time
Max  Spam Delivery Time   26.0 s time Average  Spam Delivery Time   8.0 s time Current  Spam Delivery Time   5.0 s time

Feedback / Questions

If you find this script useful, please let us know. Also, if you have any suggestions on modification for non-Sendmail systems, they would be welcome too.

E-Mail: contact@csma.biz.

 

Copyright (c) 2003, Corey S. McFadden & Associates. All rights reserved.
 For more information, please contact contact@csma.biz. Served via ewrgga-hst01 .