From ad300c035a2be4a55553c2994d5ce7ba69d57432 Mon Sep 17 00:00:00 2001 From: VVelox Date: Wed, 9 Jan 2019 23:41:39 -0600 Subject: [PATCH] various misc fixes for the postfix poller (#112) * update postfix * move a few things to reduce the number of changed lines * move mself to the end * white space cleanup and another small cleanup of $chr * use $chrNew instead of $chrC when writing the current values * more white space cleanup * replace one more missed instance of iuoscp --- snmp/postfixdetailed | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) mode change 100644 => 100755 snmp/postfixdetailed diff --git a/snmp/postfixdetailed b/snmp/postfixdetailed old mode 100644 new mode 100755 index 9bf71e9..e6cb1e9 --- a/snmp/postfixdetailed +++ b/snmp/postfixdetailed @@ -86,10 +86,10 @@ my ( $received, $rardnf, $rarnfqa, $iuscp, - $msefl, $sce, $scp, - $urr) = split ( /\n/, $old ); + $urr, + $msefl) = split ( /\n/, $old ); if ( ! defined( $received ) ){ $received=0; } if ( ! defined( $delivered ) ){ $delivered=0; } @@ -142,7 +142,6 @@ my $recipientsC=0; my $recipienthdC=0; my $deferralcrC=0; my $deferralhidC=0; -my $chrC=0; my $hcrnfqhC=0; my $sardnfC=0; my $sarnobuC=0; @@ -195,12 +194,13 @@ sub newValue{ my $output=`$pflogsumm /var/log/maillog`; -#holds client host rejected values till the end when it is compared to the old one -my $chrNew=0; - #holds RBL values till the end when it is compared to the old one my $buNew=0; + +#holds client host rejected values till the end when it is compared to the old one +my $chrNew=0; + # holds recipient address rejected values till the end when it is compared to the old one my $raruuNew=0; @@ -353,6 +353,7 @@ while ( defined( $outputA[$int] ) ){ # deferrals Host is down if ( ( $line =~ /Host is down$/ ) && ( ! $handled ) ){ $line=~s/ .*//; + $deferralcrC=$line; $deferralhidC=$line; $deferralhid=newValue( $deferralhid, $line ); $handled=1; @@ -429,8 +430,8 @@ while ( defined( $outputA[$int] ) ){ #Improper use of SMTP command pipelining if ( ( $line =~ /Improper use of SMTP command pipelining/ ) && ( ! $handled ) ){ $line=~s/.*\: //g; - $iuoscpC=$line; - $iuoscp=newValue( $iuoscp, $line ); + $iuscpC=$line; + $iuscp=newValue( $iuscp, $line ); } #Message size exceeds fixed limit @@ -453,16 +454,18 @@ while ( defined( $outputA[$int] ) ){ $scpC=$line; $scp=newValue( $scp, $line ); } - + #unknown reject reason if ( ( $line =~ /unknown reject reason/ ) && ( ! $handled ) ){ $line=~s/.*\: //g; $urrC=$line; $urr=newValue( $urr, $line ); } + $int++; } + # final client host rejected total $chr=newValue( $chr, $chrNew ); @@ -502,8 +505,8 @@ my $data=$received."\n". $iuscp."\n". $sce."\n". $scp."\n". - $urr."\n"; - $msefl."\n". + $urr."\n". + $msefl."\n"; print $data; @@ -535,10 +538,10 @@ my $current=$receivedC."\n". $rardnfC."\n". $rarnfqaC."\n". $iuscpC."\n". - $mseflC."\n". $sceC."\n". $scpC."\n". - $urrC."\n"; + $urrC."\n". + $mseflC."\n"; open(my $fh, ">", $cache) or die "Can't open '".$cache."'"; print $fh $current;