| version 1.2, 2006/09/27 19:54:27 |
version 1.3, 2006/10/18 16:39:18 |
|
|
| # |
# |
| # 11.15.2003 Version 1.0 |
# 11.15.2003 Version 1.0 |
| # |
# |
| # $RedRiver: check_email,v 1.1 2006/08/29 22:28:49 andrew Exp $ |
# $RedRiver: check_email,v 1.2 2006/09/27 18:54:27 andrew Exp $ |
| |
|
| use POSIX; |
use POSIX; |
| use lib "/usr/local/libexec/nagios" ; |
use lib "/usr/local/libexec/nagios" ; |
|
|
| |
|
| my $smtp = Net::SMTP->new($smtp_server) || done('CRITICAL', "Couldn't connect to SMTP Server $smtp_server"); |
my $smtp = Net::SMTP->new($smtp_server) || done('CRITICAL', "Couldn't connect to SMTP Server $smtp_server"); |
| |
|
| $smtp->mail($from_address) || done('CRITICAL', "Couldn't specify smtp from address $from_address on SMTP server $smtp_server"); |
$smtp->mail($from_address) || done('WARNING', "Couldn't specify smtp from address $from_address on SMTP server $smtp_server"); |
| $smtp->to($to_address) || done('CRITICAL', "Couldn't specify smtp to address $to_address on SMTP server $smtp_server"); |
$smtp->to($to_address) || done('CRITICAL', "Couldn't specify smtp to address $to_address on SMTP server $smtp_server"); |
| |
|
| $smtp->data() || done('CRITICAL', "Couldn't begin data on SMTP server $smtp_server"); |
$smtp->data() || done('CRITICAL', "Couldn't begin data on SMTP server $smtp_server"); |
|
|
| print "a POP account. Failing at any point during if there is \n"; |
print "a POP account. Failing at any point during if there is \n"; |
| print "a problem. It gives a WARNING if the mail is not received \n"; |
print "a problem. It gives a WARNING if the mail is not received \n"; |
| print "in time, and gives a CRITICAL if it cannot connect to any \n"; |
print "in time, and gives a CRITICAL if it cannot connect to any \n"; |
| print "services. Do not use an account that you want to recieve \n"; |
print "services. Do not use an account that you want to receive \n"; |
| print "mail from. This program will delete ALL mail in the mailbox \n"; |
print "mail from. This program will delete ALL mail in the mailbox \n"; |
| print "that you specify."; |
print "that you specify."; |
| print "\n"; |
print "\n"; |