[mrtg] Re: mrtg with sendmail again

Daniel R . Kilbourne drk at voyager.net
Tue Mar 13 15:47:08 MET 2001

Imran extolled:
> Target[mail]: `/usr/sbin/mailstats`

You can not call mailstats directly as a Target and have it work.
Remember, mrtg needs a certain format for input:

mailstats returns:

Statistics from Sat Feb 17 19:30:00 2001
 M   msgsfr  bytes_from   msgsto    bytes_to  msgsrej msgsdis  Mailer
 5       94        393K       19         27K        6       0  esmtp
 8      675        766K      749       1056K        0       0  local
 T      769       1159K      768       1083K        6       0

So, you need to parse the output from mailstats before sending it to mrtg.

What are you looking for? I have perl scripts (didn't write them, don't remember where they came from)
that will parse out smtp bytes and smtp message numbers. You can snag copies of them from 
http://netophilia.net/MRTG/scripts if interested.

One thing to note, however, is that you will need to get ssh working without a password between the mrtg
machine and the mail server (via .shosts or other method (I think authorized_key file maybe?)).

So, once you get these perl scripts and get the ssh passwordless stuff going, you need to have your config
changed thusly:

LogFormat: rrdtool
PathAdd: /usr/local/bin
Options[^]: perminute,nopercent,integer

Target[mail-bytes]: `/home/mrtg/configs/scripts/get-smtp-bytes.pl mail.server.com`
MaxBytes[mail-bytes]: 4000000
Title[mail-bytes]: SMTP Bytes/minute on mail.server.com
PageTop[mail-bytes]: SMTP Bytes/minute on mail.server.com
Legend1[mail-bytes]: SMTP Bytes/minute in
Legend2[mail-bytes]: SMTP Bytes/minute out
LegendI[mail-bytes]: SMTP Bytes/minute in
LegendO[mail-bytes]: SMTP Bytes/minute out

Target[mail-msg]: `/home/mrtg/configs/scripts/get-smtp-msg.pl mail.server.com`
MaxBytes[mail-msg]: 2000000
Title[mail-msg]: SMTP Messages/minute on mail.server.com
PageTop[mail-msg]: SMTP Messages/minute on mail.server.com
Legend1[mail-msg]: SMTP Messages/minute in
Legend2[mail-msg]: SMTP Messages/minute out
LegendI[mail-msg]: SMTP Messages/minute in
LegendO[mail-msg]: SMTP Messages/minute out

Lastly, remember you may need to change a few paths in the .pl files, and if you upgrade sendmail make sure
to also reinstall mailstats (something our mail people always forget:)

Run this, and let me know if this is what you are looking for.


Daniel R. Kilbourne
daniel.kilbourne at voyager.net
Network Engineering
CoreComm - Formerly Voyager.net

Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list