| 1 |
Here are the scripts I put together to gather EXIM processing information |
| 2 |
for MRTG to display. |
| 3 |
|
| 4 |
Please excuse the lack of elegance this whole thing has. It was thrown |
| 5 |
together in about an hour and I haven't had time to go back and make it |
| 6 |
pretty. There are a couple of ways I can easily think of to make this |
| 7 |
better. One would be to not use 'finger' for the gathering of information. |
| 8 |
The other would be to make one call every five minutes and use the output |
| 9 |
from it for all three items being graphed (rather than three calls every 5 |
| 10 |
minutes). One of these days I'll get around to incorporating these |
| 11 |
enhancements... |
| 12 |
|
| 13 |
The scripts that are called from MRTG (email-cout1, email-queue1, and |
| 14 |
email-totals1) get their information by 'fingering' the remote hosts. On |
| 15 |
the remote hosts, the 'fingerd' process is replaced with the check-email |
| 16 |
script. This is usually done by replacing the INETD entry on the mail host |
| 17 |
from something that looks like this: |
| 18 |
|
| 19 |
finger stream tcp nowait nobody /usr/sbin/in.fingerd in.fingerd |
| 20 |
|
| 21 |
to something that looks like this: |
| 22 |
|
| 23 |
finger stream tcp nowait nobody /usr/local/bin/check-email check-email |
| 24 |
|
| 25 |
(Note the path is where ever you decide to put the check-email script) |
| 26 |
Also, the path to GNU grep is hardcoded in the 'check-email' script. I use |
| 27 |
GNU grep for the counts which is alot faster than the normal system grep's |
| 28 |
out there. |
| 29 |
|
| 30 |
The output of check-email is: |
| 31 |
|
| 32 |
Working. |
| 33 |
====================================================================== |
| 34 |
E-mail status information for mercury.csc.com |
| 35 |
|
| 36 |
Current Date/Time is: Monday, 01/04/99 07:07 EST |
| 37 |
|
| 38 |
Number of messages currently in the queue: 54 |
| 39 |
|
| 40 |
Number of messages received so far today: 3465 |
| 41 |
Number of messages delivered so far today: 3945 |
| 42 |
|
| 43 |
END OF OUTPUT |
| 44 |
|
| 45 |
|
| 46 |
Now then for what the scripts do. email-count1 takes the count of messages |
| 47 |
received and delivered so far today and subtracts the prior values from |
| 48 |
the current values obtained from 'check-email'. This gives you the number |
| 49 |
of messages received and delivered in the last five minutes (since MRTG |
| 50 |
is called every five minutes). email-count1 has two files it tries to read |
| 51 |
without checking to see if they exist. Yes this is bad. To make it work, |
| 52 |
create files called 'HOST-NAME.infile' and 'HOST-NAME.outfile' in a |
| 53 |
directory (see the script) and put just the number 0 in there before you |
| 54 |
run the scripts. |
| 55 |
|
| 56 |
email-queue1 simply takes the queue information from 'check-email' and |
| 57 |
returns something that MRTG wants. |
| 58 |
|
| 59 |
Lastly email-totals1 takes the same count information and does a running |
| 60 |
total of the amount received and delivered since the last time the log was |
| 61 |
cleaned (for us that is every day at midnight). |
| 62 |
|
| 63 |
The file 'email.cfg' is the MRTG config file for a single host to get all |
| 64 |
three stats going. If you don't want a particular bit of information, |
| 65 |
remove the section. You will have to globally replace the TAG 'MAIL-HOST' |
| 66 |
with the name of the host you want to check. You will also probably want |
| 67 |
to change the verbage around each bit of information. That is entirely up |
| 68 |
to you :-) |
| 69 |
|
| 70 |
|