diff options
| author | beatrice <beatrice@dangofactory.net> | 2026-11-22 20:00:14 +0900 |
|---|---|---|
| committer | beatrice <beatrice@dangofactory.net> | 2026-11-22 20:00:14 +0900 |
| commit | 8f68d02045982da8f00a559835b500caf3a1967d (patch) | |
| tree | c8d0e92969b92e1b6559a0e032b6aa710a8ae2d9 /src/contrib/mrtg-mail | |
| parent | bb5ff95073e5001be7dbf58ffce80d7926deff0b (diff) | |
| download | mrtg-master.tar.gz mrtg-master.zip | |
Diffstat (limited to 'src/contrib/mrtg-mail')
| -rw-r--r-- | src/contrib/mrtg-mail/README | 260 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/inetd.conf-dist | 5 | ||||
| -rwxr-xr-x | src/contrib/mrtg-mail/mailstats | 92 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/mailstats-alternate | 29 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/mailstats-horowitz | 522 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/mailstats.cfg | 22 | ||||
| -rwxr-xr-x | src/contrib/mrtg-mail/mqueue | 15 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/mqueue.cfg | 16 | ||||
| -rw-r--r-- | src/contrib/mrtg-mail/services-dist | 3 | ||||
| -rwxr-xr-x | src/contrib/mrtg-mail/smtp-stats | 9 |
10 files changed, 0 insertions, 973 deletions
diff --git a/src/contrib/mrtg-mail/README b/src/contrib/mrtg-mail/README deleted file mode 100644 index 81d2ad1..0000000 --- a/src/contrib/mrtg-mail/README +++ /dev/null @@ -1,260 +0,0 @@ - Using Mailstats with MRTG - -# 17/04/97: These files are based on a post -# made to the MRTG discussion list. - -# I was then asked if I would contribute them to the distribution. -# Now I've cleaned up one or two minor things, but the message below -# is essentially the same as the distribution I have contributed. - -# I also posted this to comp.mail.sendmail some time back. - -# rachel polanskis <r.polanskis@nepean.uws.edu.au> - - - - -This is some experimenting I have done using sendmail and mrtg. - -Currently I am using Solaris 2.5.1 as the mailhost, and then plotting -the goodies using mrtg-2.0 on Linux 1.2.13 and displaying the graphs -on the linux box. - -There are some caveats on my method for plotting these charts: - -1: I use a previously undefined port and run the Solaris - /bin/mailstats program out of inetd. - For this reason, I can only assume the mailstat on Solaris - works - I have tried no other platforms. - -* Q: Is there a security risk involved in running Solaris Mailstat - out of inetd? - -2: You must have Perl-5.002 or better installed on the plotting host. - -3: You must have MRTG-2.0 installed - you must know how to use it! - -4: I am only interested in SMTP connections, and my scripts only - plot In and Out, since mrtg can only plot 2 lines per graph. - If you want any more than that - experiment! And then tell me - since I am only learning. - -Here goes: - -1: Ensure you have "/bin/mailstat" on your system. - -2: Enable "/etc/mail/sendmail.st" - To do this you can just make sure the entry for "sendmail.st" in - "sendmail.cf" is uncommented, and then do the command: - - # touch /etc/mail/sendmail.st - - And restart sendmail: - - # /etc/init.d/sendmail stop - # /etc/init.d/sendmail start - - -3: Create the following shell-script: - - #!/bin/sh - # smtp-stats: exec Solaris mailstats - # - if [ -x "/bin/mailstats" ] - then - exec /bin/mailstats -f/etc/mail/sendmail.st - fi - -I run this out of /opt/local/bin, and call it "smtp-stats" - -4: Now add the following to /etc/services: - - # /etc/services - # - smtp-stats 7256/tcp # smtp-stats - -I used port 7256 as it was undefined. You might like to select something -else. - -5: Add the following to /etc/inetd.conf: - - # /etc/inetd.conf - # - smtp-stats stream tcp nowait root \ - /opt/local/bin/smtp-stats smtp-stats - - -***Ensure that the above is all on *one* line. The sample above -is broken on 2 lines for legibility!! - - -6: Restart inetd - - -7: Test the port. you should see the following: - -# telnet localhost 7256 -Trying 127.0.0.1... -Connected to localhost. -Escape character is '^]'. -Statistics from Thu Feb 27 01:12:47 1997 - M msgsfr bytes_from msgsto bytes_to Mailer - 0 0 0K 96 393K prog - 3 34 94K 0 0K local - 5 93 474K 31 47K esmtp -======================================== - T 127 568K 127 440K -Connection closed by foreign host. - - -OK!! - -The line we are interested in is line 5: The "esmtp" line. -This is the line we will use to get our stats. - -You might want to adjust this depending on how many mailer progs -you use... - -I find the Totals to be useless, since it includes a lot of filtering -from procmail. I am only interested in SMTP connections... - -#################################### -Stage 2: MRTG - - -Here is a perl script I wrote to glom the values of the "esmtp" line (5) -and massage them into something mrtg understands. - -A file called "mailstats.old" is written to /tmp -to allow for doing my sums. - -I am a Perl Newbie - please don't be offended at my code. -I would like it if someone can help me with better methods one day! - -#!/usr/bin/perl -# -# rachel polanskis - 240297 -# this script relies on the sendmail.st file being activated. -# the data is called via "mailstats" which comes with SunOS/Solaris. -# mailstats is run out of inetd, on port 7256. -# -require 5.002; -use strict; -use Socket; - -my ($remote, $port, $iaddr, $paddr, $proto, $line, $count, $oldfrm, $oldto, $curfrm, $curto, $msgsfrm, $msgsto, $a, $b, $c, $d); - -## -# open the old stats file for reading - we use this to get the differences -# -open (OLD,"</tmp/mailstat.old") or die "can't open file!\n"; - -# read the old data -# -while (<OLD>) { - if ($. == "1") { - $count = $_; - } - ($oldfrm, $oldto) = split (' ',$count); -} -close (OLD); - -## -# Straight out of the blue Camel - pp. 349 -# -# Change these next 2 lines to suit yourself. -# -$remote = "juno"; -$port = "7256"; - -# -if ($port =~ /\D/) {$port = getservbyname ($port, 'tcp')} -die "No port" unless $port; - -$iaddr = inet_aton($remote) or die "no host: $remote"; -$paddr = sockaddr_in($port, $iaddr); - -$proto = getprotobyname ('tcp'); - -socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!"; -connect (SOCK, $paddr) or die "connect: $!"; - -## -# munge the output data -# -while (<SOCK>) { - - if ($. == "5" ) { - $line = $_; - ($a, $curfrm, $b, $curto, $c, $d) = split(' ',$line); - -# do some sums -$msgsfrm = $curfrm - $oldfrm; -$msgsto = $curto - $oldto; -chomp $msgsfrm; -chomp $msgsto; - -# open the old file for overwrite -open (OLD,">/tmp/mailstat.old") or die "can't open file!\n"; - -# print the data for mrtg - print "$msgsfrm\n$msgsto\n1\njuno\n"; - -# print the data to the old file - print OLD "$curfrm $curto\n"; - - } #endif - -} - -close (SOCK) or die "close: $!"; -exit; - - -########################## - -Now, Here is my mrtg.cfg file for mail. -I call it "mail.cfg" -I run mrtg from cron on my Linux box every 10 minutes to plot the stats. -It is up to the individual what they do with their own setup. - -# -# Mail: MRTG.cfg file for sendmail stats on mailhost. -# - -WorkDir: /usr/local/etc/httpd/htdocs/stats/mrtg -Interval: 10 -#--------------------------------------------------------------- -Target[mail]: `/usr/local/bin/mrtg/mailstats` -MaxBytes[mail]: 150 -Options[mail]: gauge -Title[mail]: Juno Sendmail Statistics -PageTop[mail]: Juno Sendmail Statistics</H1> -XSize[mail]: 500 -Supress[mail]: my -YSize[mail]: 200 -WithPeak[mail]: dwmy -YLegend[mail]: No. of messages -ShortLegend[mail]: messages -LegendI[mail]: Incoming: -LegendO[mail]: Outgoing: - - - -That's it!! - -You should have no problems running this stuff if you follow my -instructions. - -Any comments, advice or interesting suggestions -would be much appreciated. - -Do with my little hack as you like, as long as the developers -of sendmail, perl, and mrtg get some credit, as well as lil ol me -for dreaming this up!!! - - -have fun... - -rachel polanskis <r.polanskis@nepean.uws.edu.au> 17/04/97 - diff --git a/src/contrib/mrtg-mail/inetd.conf-dist b/src/contrib/mrtg-mail/inetd.conf-dist deleted file mode 100644 index 207ab7b..0000000 --- a/src/contrib/mrtg-mail/inetd.conf-dist +++ /dev/null @@ -1,5 +0,0 @@ -# smtp stats for mrtg -# you can add this simply by doing "cat inetd.conf-dist >>/etc/inetd.conf" - -smtp-stats stream tcp nowait root /opt/local/bin/smtp-stats smtp-stats - diff --git a/src/contrib/mrtg-mail/mailstats b/src/contrib/mrtg-mail/mailstats deleted file mode 100755 index e75bb8a..0000000 --- a/src/contrib/mrtg-mail/mailstats +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/local/bin/perl -# -# Author: Petter Reinholdtsen <pere@td.org.uit.no> -# Date: 1997-07-09 -# The original was written by Rachel Polanskis <rachel@juno.virago.org.au> -# -# Fetches output from mailstats(1) either via TCP or via exec and -# feeds changes on smtp to mrtg. -# -# Irix 6.x seems to lack mailstats -# -# Usage mailstats [host] -# if host is missing, localhost is used - -use strict; -use Socket; - -my($datafile, $source, $sourceport, @mailstatspaths, - $oldfrm, $oldto, - $newfrm, $newto, $uptime); - -# Adjust this to your own mailserver. Uses local `mailstats` if set -# to 'localhost' -$source = $ARGV[0] || "localhost"; -$sourceport = "7256"; - -$datafile = "/tmp/mailstat-$source.old"; -@mailstatspaths = ( "/usr/sbin/mailstats", "/usr/bin/mailstats" ); - -($oldfrm, $oldto) = getOldStats($datafile); - -($newfrm, $newto, $uptime) = getStats($source, $sourceport); - -putOldStats($datafile, $newfrm, $newto) || warn "$0: Unable to save stats to $datafile"; - -print $newfrm-$oldfrm,"\n",$newto-$oldto,"\n","$uptime\n$source\n" if ($oldfrm); - -## -# Returns first line of file given as param splittet on space -sub getOldStats { - my($filename) = @_; - open(OLD, $filename) || warn "$0: Unable to open $filename for reading"; - my($line) = <OLD>; - close(OLD); - return split(/ /, $line); -} - -sub findFirstExecutable { - my($filename); - foreach $filename (@_) { - return $filename if ( -x $filename && ! -d $filename ); - } -} - -sub getStats { - my($source, $sourceport) = @_; - my(@output, $port, $proto, $iaddr, $paddr); - if ( $source eq "localhost" ) { - my($progpath) = findFirstExecutable(@mailstatspaths); - @output = `$progpath`; - chomp(@output); - } else { - $port = getservbyname ($sourceport, 'tcp') if ($sourceport =~ /\D/); - die "$0: Bad port \"$sourceport\"" unless ($port); - $proto = getprotobyname ('tcp') || die "$0: Bad prototype tcp"; - - $iaddr = inet_aton($source) or die "$0: no host \"$source\""; - $paddr = sockaddr_in($port, $iaddr); - - socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "$0: socket error $!"; - connect (SOCK, $paddr) or die "$0: connect error $!"; - - while (<SOCK>) { - push(@output); - } - close(SOCK) || warn "$0: socket close error $!"; - } - my($curfrm, $curto, $uptime); - foreach (@output) { - ($curfrm, $curto) = (split(/ +/))[2,4] if (/e?smtp/); - ($uptime) = m/Statistics from (.*)/ if (/Stati/); - } - return ($curfrm, $curto, $uptime); -} - -sub putOldStats { - my($filename, $frm, $to) = @_; - open(STAT, ">$filename") || return ""; - print STAT "$frm $to\n"; - close(STAT); - return "1"; -} diff --git a/src/contrib/mrtg-mail/mailstats-alternate b/src/contrib/mrtg-mail/mailstats-alternate deleted file mode 100644 index 7443e36..0000000 --- a/src/contrib/mrtg-mail/mailstats-alternate +++ /dev/null @@ -1,29 +0,0 @@ -# use this method if you think it is better... -# I did this one after I learnt a bit more perl! - - -## -# munge the output data -# -while (<SOCK>) { - $line = $_; - ($a, $curfrm, $b, $curto, $c, $d) = split(' ',$line); -} -if ($a = "T") { -# do some sums -$msgsfrm = $curfrm - $oldfrm; -$msgsto = $curto - $oldto; -chomp $msgsfrm; -chomp $msgsto; - -# open the old file for overwrite -open (OLD,">/tmp/mailstat.old") or die "can't open file!\n"; -# print the data for mrtg - print "$msgsfrm\n$msgsto\n1\n$remote\n"; - -# print the data to the old file -print OLD "$curfrm $curto\n"; - } #endif - -close (SOCK) or die "close: $!"; -exit; diff --git a/src/contrib/mrtg-mail/mailstats-horowitz b/src/contrib/mrtg-mail/mailstats-horowitz deleted file mode 100644 index 82dec14..0000000 --- a/src/contrib/mrtg-mail/mailstats-horowitz +++ /dev/null @@ -1,522 +0,0 @@ -#!/usr/bin/perl -# -# Author by Rick Horowitz <rick@techstop.com> 1998-12-16 -# Inspired by, and may show remnants of code from: -# "mailstats" by Petter Reinholdtsen <pere@td.org.uit.no> -# dated 1997-07-09 and part of mrtg2.54c dist -# Petter credits Rachel Polanskis <rachel@juno.virago.org.au> for -# the original. -# Type "perldoc mrtg-mailstat" from a shell prompt for more information -# on this script and its use. -# - -use strict; -use Socket; -use Getopt::Long; - -# IMPORTANT: THIS NEXT LINE ENSURE THAT CASE MATTERS ON OPTIONS!!! -$Getopt::Long::ignorecase = 0; - -use vars qw($datafile $server $sourceport $oldfrm $oldto $help - $newfrm $newto $uptime $mailtype $logbase); - -# Assign options. ("Illegal" options will be possible, -# but we'll warn about them via Usage().) -# h = runs the perldoc program to show the mrtg-mailstat manual -# m = specifies the type of mail we're checking for -# p = specifies the port for reaching the mailstats on the mailserver -# s = specifies the location of the mailserver -# See the mrtg-mailstat man page for details. -GetOptions("help" => \$help, - "logbase=s" => \$logbase, - "mailtype=s" => \$mailtype, - "port=i" => \$sourceport, - "server=s" => \$server, - "<>" => \&Usage); - -# HARDCODING SECTION -- MODIFY THESE ONLY IF YOU KNOW WHAT YOU ARE DOING!!! -# Set these ONLY if you don't wish to use command line options. For more -# information, type 'mrtg-mailstat -h' or 'perldoc mrtg-mailstat' from a -# shell prompt. -$logbase = '/tmp' unless $logbase; -$mailtype = '' unless $mailtype; -$server = '' unless $server; -$sourceport = '' unless $sourceport; - -# Location for keeping mail statistics. The numbers stored here are -# compared to the new numbers at each run of this script. -$datafile = "$logbase/${mailtype}-mailstat.old"; - -# Core portions of the program. Most of retained code from original -# comes into play here. -GetHelp() if $help; -Usage() unless ($mailtype && $server && $sourceport); - -($oldfrm, $oldto) = GetOldStats($datafile); -($newfrm, $newto, $uptime) = GetNewStats($server, $sourceport); - -PutOldStats($datafile, $newfrm, $newto) || warn "$0: Unable to save stats to $datafile"; - -print $newfrm-$oldfrm,"\n",$newto-$oldto,"\n","$uptime\nthe mail server\n" if ($oldfrm); - -## -# Returns first line of file given as param split on (a single) space -sub GetOldStats { - my($datafile) = @_; - - if (-e $datafile) { - open(OLD, $datafile) || warn "$0: Unable to open $datafile for reading"; - my($line) = <OLD>; - close(OLD); - return split(/ /, $line); - } else { - return(0, 0); - } - -} - -sub GetNewStats { - my($server, $sourceport) = @_; - my(@output, $port, $proto, $iaddr, $paddr, $tempuptime, $curfrm, $curto, $uptime); - if ( $server eq "localhost" ) { - @output = `/usr/sbin/mailstats`; - chomp(@output); - } else { - if ($sourceport =~ /\D/) { - $port = getservbyname ($sourceport, 'tcp'); - } else { - $port = $sourceport; - } - die "$0: Bad port \"$sourceport\"" unless ($port); - $proto = getprotobyname ('tcp') || die "$0: Bad prototype tcp"; - - $iaddr = inet_aton($server) or die "$0: no host \"$server\""; - $paddr = sockaddr_in($port, $iaddr); - - socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "$0: socket error $!"; - connect (SOCK, $paddr) or die "$0: connect error $!"; - - while (<SOCK>) { - push(@output, $_); - } - close(SOCK) || warn "$0: socket close error $!"; - } - - # Parse only the interesting lines. - foreach (@output) { - ($curfrm, $curto) = (split(/ +/))[2,4] if (/$mailtype/); - if (/UPTIME.*?up\s*(.*?), [0-9]* user/) { - $uptime = $1; - $uptime =~ s/:([0-9]*)/ hours, $1 minutes/; - } - } - - # This line ensures no negative numbers. See "perldoc mrtg-mailstat". - ($curfrm, $curto) = noNeg($curfrm, $curto); - - return ($curfrm, $curto, $uptime); - -} # End GetNewStats(). - -# Saves the information to the log file. (Note: Overwrites old contents -# which aren't needed anymore, anyway.) -sub PutOldStats { - my($datafile, $frm, $to) = @_; - open(STAT, ">$datafile") || return ""; - print STAT "$frm $to\n"; - close(STAT); - return "1"; -} # End PutOldStats(). - -# Negative values should only occur the first time the script is ever run. -# These must be converted to positives so subsequent runs of the script -# correctly compute new values. -sub noNeg { - - my ($frm, $to) = @_; - - $frm = -($frm) if ($frm < 0); - $to = -($to) if ($to < 0); - - return($frm, $to); - -} # End noNeg(). - -# Usage() simply checks to see that no "illegal" options -# have been entered. If the program is thus improperly -# called, it issues a notice explaining how to read the -# man page for this program. -sub Usage { - - my $option = shift; - - print STDERR "You may wish to read the documentation \n"; - print STDERR "(type \"perldoc mrtg-mailstat\" or \"mrtg-mailstat -h\")\n"; - - exit(5); - -} # End Usage(). - -sub GetHelp { - - system("perldoc mrtg-mailstat"); - exit(0); - -} # End GetHelp(). - -__END__ - -=head1 NAME - -mrtg-mailstat - Mail Statistics Collector for MRTG - -=head1 SYNOPSIS - -mrtg-mailstat S<[B<-h>]> S<[B<-m> I<mailtype>]> S<[B<-p> I<sourceport>]> - S<[B<-s> I<server>]> - -=head1 DESCRIPTION - -The B<mrtg-mailstat> program retrieves statistical information from the -mail server. It does not matter whether the script is run on the mail -server itself, or on a machine remote from the mail server. - -=head1 S< Running mrtg-mailstat > - -S< > -The proper way to run B<mrtg-mailstat> is to call it from an MRTG configuration -file. The following provides an example of a valid configuration file entry: - -=over 2 - -=item - -C<S<Target[smtp-mail]: `mrtg-mailstat -m smtp -p 7258 -s mail.techstop.com`> -S<MaxBytes[smtp-mail]: 150 > -S<Options[smtp-mail]: gauge > -S<Title[smtp-mail]: TechStop Support Services SMTP Mail Statistics> -S<PageTop[smtp-mail]: E<lt>H1E<gt>TechStop SMTP Mail Statistics E<lt>/H1E<gt>> -S<XSize[smtp-mail]: 500 > -S<YSize[smtp-mail]: 200 > -S<WithPeak[smtp-mail]: dwmy> -S<YLegend[smtp-mail]: No. of messages> -S<ShortLegend[smtp-mail]: messages> -S<LegendI[smtp-mail]: Incoming:> -S<LegendO[smtp-mail]: Outgoing: > > - -=back - -This makes certain assumptions which are outlined below under I<Dependencies>. - -=head1 S< Switches > - -S< > - -=head2 Hardcoding versus Using Switches - -It is not necessary to provide switches to the program, if you prefer to "hardcode" -the information in the script itself. "Hardcoding" allows you to call the script -with less (or no) flags; information needed by the script, and not provided by a -flag, must be "hardcoded" by you before this will work. (This was provided for -diehards who hate the flexibility of switches. I provided enough flexibility for -them to be inflexible. ;)) - -To "hardcode" your information into the script, look for the section near the -top of the script labeled "HARDCODING SECTION". Change the "null" entries -represented by the double double quotes ("") so that they contain the appropriate -values. - -Example: - - -=over 4 - -=item - -C<$server = "" unless $server; > - -=back - -becomes - -=over 4 - -=item - -C<$server = "mail.techstop.com" unless $server; > - -=back - -As stated, this is not necessary; it is not even preferred. You may, -and probably should, use the switches in the next subsection. - -=head2 Invoking Switches - -B<mrtg-mailstat> switches adhere to the POSIX syntax for command-line -options. This means options can take a variety of forms. -For example, to specify running B<mrtg-mailstat> against port C<7258> -of the mail server to obtain reports on smtp mail (see "I<mailtype> -under I<Available Switches> below) you could use any of the following forms: - -=over 5 - -=item - -C<% mrtg-mailstat -m smtp -p 7258> - -=item - -C<% mrtg-mailstat -m=smtp -p=7258> - -=item - -C<% mrtg-mailstat -mailtype smtp -port 7258> - -=item - -C<% mrtg-mailstat -mailtype=smtp -port=7258> - -=item - -C<% mrtg-mailstat --m smtp --p 7258> - -=item - -C<% mrtg-mailstat --m=smtp --p=7258> - -=item - -C<% mrtg-mailstat --mailtype smtp --port 7258> - -=item - -C<% mrtg-mailstat --mailtype=smtp --port=7258> - -=back - -Any of the last four forms are preferred. One way of doing options -which is I<not> possible is: - -=over 5 - -=item - -C<% mrtg-mailstat --msmtp --p7258> - -=back - -Use of that last form may cause results other than you expected. -(Important Note: The above examples would also require that the -server be "hardcoded" into the script as noted in the subsection on -I<Hardcoding versus Using Switches> above.) - -=head2 Available Switches - -The following switches are available: - -=over 2 - -=item B<--h[elp]> - -The B<-h> flag causes B<mrtg-mailstat> to print this manual to -standard output. For obvious reasons, this is not normally included in an -MRTG configuration file, nor invoked by cron. - -=item B<--l[ogbase]> - -The B<-l> flag can be used to specify the directory in which to store the -file that holds the values from each run. By default, this file is created -in I</tmp>, but if you need to store it in another directory, this is the -flag for you. By the way, if the file doesn't exist, one is created. A side-effect -of this is that if you try to use one "logbase" one time, and another the next, -the program has no way of warning you. It simply creates a new file, and uses zero -values to begin its calculations. This can have strange consequences for your -mail statistics. Try to remember where you store your log, or use the hardcoding -option (see I<Hardcoding versus Using Switches> above). - -=item B<--m[ailtype]> - -The B<-m> flag is used to specify the mail type. The two -types reported by I</usr/bin/mailstat> are "esmtp" and "local". The -"esmtp" line reports traffic between the mail server and other systems. -The "local" line reports traffic between users on the mail server. For -most smaller networks, this likely means that "esmtp" reports mail between -their network and the Internet, and "local" reports mail between users -within the small network's organization. Possible values for this flag are -"smtp" and "local". B<Note the flag takes "smtp" and not "esmtp".> - -=item B<--p[ort]> - -The B<-p> flag specifies the port whence the statistics are obtained. See -the I<Dependencies> section below. - -=item B<--s[erver]> - -The B<-s> flag specifies the mail server. This can be either a DNS name, -or an IP number. - -=back - -=head1 DEPENDENCIES - -The B<mrtg-mailstat> program makes certain assumptions. The following is -quoted with a few changes from the documentation for the original B<mailstat> script -upon which B<mrtg-mailstat> is based. In particular, it is important to note that -the original instructions were Solaris-centric. Your system may have different commands -for starting and stopping the mail server, and your paths may be different (i.e., may -use /usr/local instead of /opt, or whatever). You are assumed to be able to figure that -out yourself. - -=over 2 - -=item 1: Ensure you have I</bin/mailstat> (or I</usr/sbin/mailstat>)on your system. - -=item 2: Enable I</var/log/sendmail.st> - - To do this you can just make sure the entry for "sendmail.st" in - "sendmail.cf" is uncommented. On the BSD/OS 3.1 system mrtg-mailstat was - tested on, the /etc/sendmail.cf entries look like this: - - OS/var/log/sendmail.st - O StatusFile=/var/log/sendmail.st - - - Then do the command: - - # touch /var/log/sendmail.st - - And restart sendmail: - - # /etc/init.d/sendmail stop - # /etc/init.d/sendmail start - - -=item 3: Create the following shell-script (B<Note!> This section is different than the original version!): - - #!/bin/sh - # - # smtp-stats: invoke mailstats from a wrapper for use in inetd. - # - PATH=/bin:/sbin - if [ -x "/usr/sbin/mailstats" ] - then - temp1=`/usr/sbin/mailstats -f/var/log/sendmail.st` - fi - - if [ -x "/usr/bin/uptime" ] - then - temp2=`/usr/bin/uptime` - fi - - echo -e "$temp1\nUPTIME: $temp2" - -I run this out of /usr/local/bin, and call it "smtp-stats" - -=item 4: Now add the following to /etc/services: - - # /etc/services - # - smtp-stats 7256/tcp # smtp-stats - -I used port 7256 as it was undefined. You might like to select something -else. - -=item 5: Add the following to /etc/inetd.conf: - - # /etc/inetd.conf - # - smtp-stats stream tcp nowait root \ - /usr/local/bin/smtp-stats smtp-stats - - -***Ensure that the above is all on *one* line. The sample above -is broken on 2 lines for legibility!! - - -=item 6: Restart inetd - - -=item 7: Test the port. you should see the following: - -S< > -S<unixhost: {26} % telnet mailserver 7258 > -S<Trying 192.168.1.8... > -S<Connected to mailserver.yourdomain.com. > -S<Escape character is '^]'. > -S<Statistics from Wed Jan 14 03:10:34 1998 > -S< M msgsfr bytes_from msgsto bytes_to Mailer > -S< 3 79372 3623347K 143989 6954437K local > -S< 5 9941 483230K 6669 652586K esmtp > -S<======================================== > -S< T 89313 4106577K 150658 7607023K > -S<UPTIME: 9:02AM up 52 days, 48 mins, 2 users, load averages: 0.57, 0.56, 0.43> -S<Connection closed by foreign host. > - - -=back - -=head1 FILES - -Strictly speaking, you needn't worry about the files. If you've created -the smtp-stats script noted above, and made the appropriate changes, the -only other I<file> you need to be concerned with is B<mrtg-mailstat> itself. - -For completeness sake, I list all the files with which B<mrtg-mailstat> may -depend upon, utilize, create, or use. - -=over 5 - -=item - -I<mrtg-mailstat> - -=item - -I</etc/sendmail.cf> - -=item - -I</usr/local/bin/smtp-stats> - -=item - -I</usr/sbin/mailstats> - -=item - -I</usr/bin/uptime> - -=item - -I</var/log/sendmail.st> - -=item - -I<$logbase/${mailtype}-mailstat.old> - -=back - - -=head1 AUTHOR - -This B<mrtg-mailstat> program was written by Rick Horowitz <rick@techstop.com>, -tested, and released to the MRTG mailing list on December 16, 1998. It was -inspired by, and contains remnants of code from: - -=over 10 - -=item - - "mailstats" by Petter Reinholdtsen <pere@td.org.uit.no> - dated 1997-07-09 and part of mrtg2.54c dist - -=back - -Petter credits Rachel Polanskis <rachel@juno.virago.org.au> for -the original. - -=cut - - - - diff --git a/src/contrib/mrtg-mail/mailstats.cfg b/src/contrib/mrtg-mail/mailstats.cfg deleted file mode 100644 index 33fc6ef..0000000 --- a/src/contrib/mrtg-mail/mailstats.cfg +++ /dev/null @@ -1,22 +0,0 @@ -# -# Mail.cfg: Mailstats plotting with MRTG -# - -WorkDir: /usr/local/etc/httpd/htdocs/stats/mrtg -Interval: 10 -#--------------------------------------------------------------- -Target[mail]: `/usr/local/bin/mrtg/mailstats` -MaxBytes[mail]: 150 -# AbsMax[mail]: 1800 -#Unscaled[mail]: dwmy -Options[mail]: gauge -Title[mail]: Juno Sendmail Statistics -PageTop[mail]: Juno Sendmail Statistics</H1> -XSize[mail]: 500 -#Supress[mail]: my -YSize[mail]: 200 -WithPeak[mail]: dwmy -YLegend[mail]: No. of messages -ShortLegend[mail]: messages -LegendI[mail]: Incoming: -LegendO[mail]: Outgoing: diff --git a/src/contrib/mrtg-mail/mqueue b/src/contrib/mrtg-mail/mqueue deleted file mode 100755 index fa30105..0000000 --- a/src/contrib/mrtg-mail/mqueue +++ /dev/null @@ -1,15 +0,0 @@ -#!/store/bin/perl -# simple mqueue done with find2perl - -$hostname = "apollo"; - -require "find.pl"; -# Traverse desired filesystems -$counter = 0; -&find('/var/spool/mqueue/'); -sub wanted { - /^qf.*$/ && -$counter++; -} -chomp $counter; -print "0\n$counter\n1\n$hostname\n"; diff --git a/src/contrib/mrtg-mail/mqueue.cfg b/src/contrib/mrtg-mail/mqueue.cfg deleted file mode 100644 index d7c7802..0000000 --- a/src/contrib/mrtg-mail/mqueue.cfg +++ /dev/null @@ -1,16 +0,0 @@ -Interval: 5 -#--------------------------------------------------------------- -Target[mq]: `/opt/mrtg/bin/mqueue` -MaxBytes[mq]: 32000 -AbsMax[mq]: 64000 -Options[mq]: gauge -Title[mq]: Sendmail Statistics -PageTop[mq]: <H2>Sendmail MailQueue Statistics</H2> -XSize[mq]: 500 -Supress[mq]: y -YSize[mq]: 128 -WithPeak[mq]: my -YLegend[mq]: No. of messages in mailq -ShortLegend[mq]: Mailq -LegendO[mq]: Mailq: -LegendI[mq]: diff --git a/src/contrib/mrtg-mail/services-dist b/src/contrib/mrtg-mail/services-dist deleted file mode 100644 index 84de5ba..0000000 --- a/src/contrib/mrtg-mail/services-dist +++ /dev/null @@ -1,3 +0,0 @@ -# You can add this simply by doing "cat services-dist >> /etc/services" - -smtp-stats 7256/tcp # smtp-stats diff --git a/src/contrib/mrtg-mail/smtp-stats b/src/contrib/mrtg-mail/smtp-stats deleted file mode 100755 index e3dfaaf..0000000 --- a/src/contrib/mrtg-mail/smtp-stats +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# smtp-stats: invoke mailstats from a wrapper for use in inetd. -# -PATH=/bin:/sbin -if [ -x "/bin/mailstats" ] - then - exec /bin/mailstats -f/etc/mail/sendmail.st - fi |
