[Logwatch-Devel] sendmail script from LogWatch (fwd)
Kenneth Porter
shiva@sewingwitch.com
Sat, 04 Jan 2003 07:40:26 -0800
--==========09754931==========
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
(Forwarded to logwatch-devel list for next update.)
This looks pretty cool for the ISP's and MX secondaries among you.
------------ Forwarded Message ------------
Date: Friday, January 03, 2003 10:19 AM +1030
From: Jim O'Halloran <jim@kendle.com.au>
To: "'shiva@well.com'" <shiva@well.com>
Subject: sendmail script from LogWatch
Hi,
I've made a few changes to the sendmail script from the logwatch package.
According to the comments at the top of the file you're the maintainer of
this particular script, so I thought I'd send you a diff of the changes in
case you wanted to incorporate them back into the package.
There are three changes to the script...
* The script now keeps a count of the number of messages virus scanned by
Amavis-milter.
* We're the secondary MX for some of our customers domains, so the script
will summarise and report on the ETRN's issues for these domains.
* Occasionally our server will stop responding to inbound connections
because of a high load average. The script now summarises and reports on
these events also.
Hope you find these useful.
Jim.
---
Jim O'Halloran
Kendle Computer Services Pty. Ltd.
Phone: (08) 8354 1600 (intl. +61-8-8354-1600)
Fax: (08) 8354 1900 (intl. +61-8-8354-1900)
"Don't half heatedly wound a problem. Kill it
dead." - Clarence "Kelly" Johnson
---------- End Forwarded Message ----------
--==========09754931==========
Content-Type: text/plain; charset=iso-8859-1; name="sendmail.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="sendmail.patch"; size=1978
*** sendmail.orig Fri Jan 3 08:40:40 2003--- sendmail Fri Jan 3 09:38:36 =
2003****************** 41,46 ****--- 41,48 ---- } elsif ( ($Bytes) =3D =
($ThisLine =3D~ /^from=3D.*size=3D([0-9]+).*$/) ) { $MsgsSent++; =
$BytesTransferred +=3D $Bytes;+ } elsif ( $ThisLine =3D~ =
m/X-Virus-Scanned: by amavisd-milter/) {+ $Amavis++; } elsif ( =
($User) =3D ($ThisLine =3D~ /^<([^ ]*)>... User unknown$/) ) { =
$UnknownUsers{$User}++; } elsif ( ($Host) =3D ($ThisLine =3D~ /\(Name =
server: ([^ ]+): host not found\)/)) {****************** 110,115 ****--- =
112,122 ---- $Timeouts{$1}++; } elsif ( $ThisLine =3D~ m/timeout =
writing message to (\S+?)\.?:/ ) { $Timeouts{$1}++;+ } elsif ( =
$ThisLine =3D~ /\[([0-9\.]+)]: ETRN (\S+)/ ) {+ chomp($ETRN=3D$3." =
from ".$2);+ $ETRNs{$ETRN}++;+ } elsif ( $ThisLine =3D~ /rejecting =
connections on daemon MTA: load average: ([0-9]+)/ ) {+ =
$LoadAvg{$1}++; } else { $ThisLine =3D~ s/.*\: (DSN\: .*)/$1/; =
$ThisLine =3D~ s/.*\: (postmaster notify\: =
.*)/$1/;****************** 124,129 ****--- 131,140 ---- print "\n" . =
$MsgsSent . " messages sent"; } + if ($Amavis > 0) {+ print "\n" . =
$Amavis . " messages scanned by Amavis";+ }+ if ($HourReturns > 0) { =
print "\n\n" . $HourReturns . " messages returned after " . $NumHours . " =
hours"; }****************** 134,139 ****--- 145,164 ---- if =
($UserUnknown > 0) { print "\n\n" . $UserUnknown . " unidentified =
unknown users";+ }+ + if (keys %ETRNs) {+ print "\n\nETRNs =
Received:\n";+ foreach $ThisOne (sort keys %ETRNs) {+ print " " =
. $ThisOne . ": " . $ETRNs{$ThisOne} . " Times(s)\n";+ }+ }+ + if (keys =
%LoadAvg) {+ print "\n\nConnections Rejected due to load average::\n";+ =
foreach $ThisOne (sort keys %LoadAvg) {+ print " Load Avg " . =
$ThisOne . ": " . $LoadAvg{$ThisOne} . " Times(s)\n";+ } } if (keys =
%UnknownUsers) {
--==========09754931==========--