diff --git a/ProjectCode/Agents/librenms/postfix-queue,sh b/ProjectCode/Agents/librenms/postfix-queues similarity index 76% rename from ProjectCode/Agents/librenms/postfix-queue,sh rename to ProjectCode/Agents/librenms/postfix-queues index 57f0aef..1d3491e 100644 --- a/ProjectCode/Agents/librenms/postfix-queue,sh +++ b/ProjectCode/Agents/librenms/postfix-queues @@ -8,6 +8,6 @@ QUEUES="incoming active deferred hold" for i in $QUEUES; do - COUNT=`qshape $i | grep TOTAL | awk '{print $2}'` + COUNT=$(qshape "$i" | grep TOTAL | awk '{print $2}') printf "$COUNT\n" -done \ No newline at end of file +done diff --git a/ProjectCode/Agents/librenms/postfix-detailed.sh b/ProjectCode/Agents/librenms/postfixdetailed similarity index 98% rename from ProjectCode/Agents/librenms/postfix-detailed.sh rename to ProjectCode/Agents/librenms/postfixdetailed index 9902257..e6cb1e9 100644 --- a/ProjectCode/Agents/librenms/postfix-detailed.sh +++ b/ProjectCode/Agents/librenms/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; @@ -193,14 +192,15 @@ sub newValue{ } -my $output=`$pflogsumm /var/log/mail.log`; - -#holds client host rejected values till the end when it is compared to the old one -my $chrNew=0; +my $output=`$pflogsumm /var/log/maillog`; #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; diff --git a/ProjectCode/Modules/OAM/oam-librenms.sh b/ProjectCode/Modules/OAM/oam-librenms.sh index 348aeea..b3c8a5c 100644 --- a/ProjectCode/Modules/OAM/oam-librenms.sh +++ b/ProjectCode/Modules/OAM/oam-librenms.sh @@ -49,8 +49,8 @@ cat ../../Agents/librenms/dpkg.sh > /usr/lib/check_mk_agent/local/dpkg.sh cat ../../Agents/librenms/ntp-client.sh > /usr/lib/check_mk_agent/local/ntp-client.sh #cat ../../Agents/librenms/ntp-server.sh > /usr/lib/check_mk_agent/local/ntp-server.sh cat ../../Agents/librenms/os-updates.sh > /usr/lib/check_mk_agent/local/os-updates.sh -cat ../../Agents/librenms/postfix-detailed.sh > /usr/lib/check_mk_agent/local/postfix-detailed.sh -#cat ../../Agents/librenms/postfix-queue.sh > /usr/lib/check_mk_agent/local/postfix-queue.sh +cat ../../Agents/librenms/postfixdetailed > /usr/lib/check_mk_agent/local/postfixdetailed +cat ../../Agents/librenms/postfix-queues > /usr/lib/check_mk_agent/local/postfix-queues #cat ../../Agents/librenms/smart.sh > /usr/lib/check_mk_agent/local/smart #cat ../../Agents/librenms/smart.sh.config > /usr/lib/check_mk_agent/local/smart.config diff --git a/ProjectCode/SetupNewSystem.sh b/ProjectCode/SetupNewSystem.sh index 6d9ea8a..d41515d 100644 --- a/ProjectCode/SetupNewSystem.sh +++ b/ProjectCode/SetupNewSystem.sh @@ -186,6 +186,7 @@ cockpit \ iptables \ netfilter-persistent \ iptables-persistent \ +pflogsumm \ postfix export KALI_CHECK