Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
In general this script works fine. Thanks for the effort of making this for the community.
There is some minor room for improvement though which a wanted to share.
The nagios embedded perl interpreter (can be switched on/off) runs check commands with use strict.
So at line 28 the “$result =” should be “my $result =”, otherwise use strict (of the embedded perl) will fail.
But if the above is changed it clashes with “my $result =” on line 79 . This should be changed to something like “my $smtp_result =”. The $result at line 82 and 86 should be changed accordingly.
The regexp at line 82 only catches if amavis is configures with “$final_virus_destiny = D_DISCARD” or “$final_virus_destiny = D_ACCEPT”. It fails in case of “$final_virus_destiny = D_REJECT”.
An alternative for rule 82 might be:
if ( $smtp_result =~/2.7.[01] Ok, discarded/ or $smtp_result =~/5.7.[01] Reject, id=/ ) {
Or even better perhaps to:
if ( $smtp_result =~ /INFECTED:sEicar-Test-Signature/ ) {
Just a few thoughts for improvement.
Thanks again for the effort.