Search Exchange
Search All Sites
Login
check_amavis
Current Version
1.1
Last Release Date
2011-12-22
Compatible With
- Nagios 3.x
Owner
E-mail
License
GPL
Hits
59547
Files:
| File | Description |
|---|---|
| amavis_check.pl | amavis_check.pl |
| check_amavis.pl | v1.1 (bugfixes) |
This check talks with amavisd-new daemon (default port is 10024) with SMTP protocol.
It tests if the daemon is up and if it's able to scan an email with a virus (EICAR test virus is sent).
Please note that if amavisd-new is run on a different machine, you should enable the connection from nagios ip address (take a look at amavisd.conf).
This Perl script needs GetOpt::Long, MIME::Tools and Net::SMTP to work.
Parameters:
--server amavisd-new address (mandatory)
--port amavisd-new port (default 10024)
--from sender email address (mandatory)
--to recipient address (if not present copied from --from)
--debug useful for debugging (launch it at command line)
Command configuration:
define command{
command_name check_amavis
command_line $USER1$/check_amavis.pl --server $HOSTADDRESS$ --from email_address --to email_address --port 10024
}
where email_address is a valid email address handled by amavisd.
It tests if the daemon is up and if it's able to scan an email with a virus (EICAR test virus is sent).
Please note that if amavisd-new is run on a different machine, you should enable the connection from nagios ip address (take a look at amavisd.conf).
This Perl script needs GetOpt::Long, MIME::Tools and Net::SMTP to work.
Parameters:
--server amavisd-new address (mandatory)
--port amavisd-new port (default 10024)
--from sender email address (mandatory)
--to recipient address (if not present copied from --from)
--debug useful for debugging (launch it at command line)
Command configuration:
define command{
command_name check_amavis
command_line $USER1$/check_amavis.pl --server $HOSTADDRESS$ --from email_address --to email_address --port 10024
}
where email_address is a valid email address handled by amavisd.
Reviews (3)
Plugin works fine, but can´t detect if clamav (or any other is down)
I have added timeout to the smtp connection, if clamav is down, amavis holds for 15 seconds, using timout can detect it:
my $smtp = new Net::SMTP(
$server,
Port => $port,
Debug => $debug,
Timeout => $timeout
);
I have added timeout to the smtp connection, if clamav is down, amavis holds for 15 seconds, using timout can detect it:
my $smtp = new Net::SMTP(
$server,
Port => $port,
Debug => $debug,
Timeout => $timeout
);
bymerlin-tc, June 3, 2010
There is a bug if the server is unreachable.
The plugin will print CRITICAL but the exit code is still 0 so Nagios will think the status is ok.
You should use exit 2;
if (!$smtp) {
print "CRITICAL - amavisd-new server unreachable
";
exit 2;
}
Besides that the plugin works great.
The plugin will print CRITICAL but the exit code is still 0 so Nagios will think the status is ok.
You should use exit 2;
if (!$smtp) {
print "CRITICAL - amavisd-new server unreachable
";
exit 2;
}
Besides that the plugin works great.
byoerli, May 10, 2010
I needed to change the result from 2.7.1 to 2.7.0 and I added the exit 1; otherwise the state won't change in nagios. thanks for this script!
if ($result =~/2.7.0 Ok, discarded/) {
print "OK - All fine\n"
} else {
print "CRITICAL - amavisd-new returned $result";
exit 1;
}
if ($result =~/2.7.0 Ok, discarded/) {
print "OK - All fine\n"
} else {
print "CRITICAL - amavisd-new returned $result";
exit 1;
}


New Listings


