[Nagiosplug-checkins] nagiosplug/contrib check_email_loop.pl,1.2,1.3
Stanley Hopcroft
stanleyhopcroft at users.sourceforge.net
Wed Feb 2 01:49:45 CET 2005
Update of /cvsroot/nagiosplug/nagiosplug/contrib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15969
Modified Files:
check_email_loop.pl
Log Message:
Add debug option from John Rouillard
Index: check_email_loop.pl
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/contrib/check_email_loop.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- check_email_loop.pl 1 Feb 2005 04:19:54 -0000 1.2
+++ check_email_loop.pl 2 Feb 2005 09:47:45 -0000 1.3
@@ -47,10 +47,11 @@
my $state = "UNKNOWN";
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
-my ($lostwarn, $lostcrit,$pendwarn, $pendcrit);
+my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
# Internal Vars
my ($pop,$msgcount, at msglines,$statinfo, at messageids,$newestid);
+my (%other_smtp_opts);
my ($matchcount,$statfile) = (0,"check_email_loop.stat");
# Subs declaration
@@ -70,6 +71,7 @@
my $status = GetOptions(
"from=s",\$sender,
"to=s",\$receiver,
+ "debug", \$debug,
"pophost=s",\$pophost,
"popuser=s",\$popuser,
"passwd=s",\$poppasswd,
@@ -108,8 +110,14 @@
my $serial = time();
$serial = "ID#" . $serial . "#$$";
+
# sending new ping email
-my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout)
+%other_smtp_opts={};
+if ( $debug == 1 ) {
+ $other_smtp_opts{'Debug'} = 1;
+}
+
+my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts)
|| nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
($smtp->mail($sender) &&
$smtp->to($receiver) &&
@@ -233,7 +241,8 @@
print " -pendwarn=num WARNING-state if more than num pending emails\n";
print " -pendcrit=num CRITICAL \n";
print " -maxmsg=num WARNING if more than num emails on POP3 (default 50)\n";
- print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n\n";
+ print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n";
+ print " -debug send SMTP tranaction info to stderr\n\n";
print " Options may abbreviated!\n";
print " LOST mails are mails, being sent before the last mail arrived back.\n";
print " PENDING mails are those, which are not. (supposed to be on the way)\n";
More information about the Commits
mailing list