summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanley Hopcroft <stanleyhopcroft@users.sourceforge.net>2005-02-02 09:47:45 +0000
committerStanley Hopcroft <stanleyhopcroft@users.sourceforge.net>2005-02-02 09:47:45 +0000
commit227c04a6886b708ce23cb9fd97e49b000228b1cb (patch)
tree4b88f2221a7c78d6052653c9407e88afd5a9d08a
parent93c1c1d84517f1d11a91636c4e045c9f2e8e279a (diff)
downloadmonitoring-plugins-227c04a6886b708ce23cb9fd97e49b000228b1cb.tar.gz
Add debug option from John Rouillard
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1128 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r--contrib/check_email_loop.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/contrib/check_email_loop.pl b/contrib/check_email_loop.pl
index 965f8512..7e0a9f0e 100644
--- a/contrib/check_email_loop.pl
+++ b/contrib/check_email_loop.pl
@@ -47,10 +47,11 @@ my %ERRORS = ('UNKNOWN' , '-1',
47my $state = "UNKNOWN"; 47my $state = "UNKNOWN";
48my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned); 48my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned);
49my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50); 49my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50);
50my ($lostwarn, $lostcrit,$pendwarn, $pendcrit); 50my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug);
51 51
52# Internal Vars 52# Internal Vars
53my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); 53my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
54my (%other_smtp_opts);
54my ($matchcount,$statfile) = (0,"check_email_loop.stat"); 55my ($matchcount,$statfile) = (0,"check_email_loop.stat");
55 56
56# Subs declaration 57# Subs declaration
@@ -70,6 +71,7 @@ alarm($TIMEOUT);
70my $status = GetOptions( 71my $status = GetOptions(
71 "from=s",\$sender, 72 "from=s",\$sender,
72 "to=s",\$receiver, 73 "to=s",\$receiver,
74 "debug", \$debug,
73 "pophost=s",\$pophost, 75 "pophost=s",\$pophost,
74 "popuser=s",\$popuser, 76 "popuser=s",\$popuser,
75 "passwd=s",\$poppasswd, 77 "passwd=s",\$poppasswd,
@@ -108,8 +110,14 @@ if (!open STATF, ">$statfile") {
108my $serial = time(); 110my $serial = time();
109$serial = "ID#" . $serial . "#$$"; 111$serial = "ID#" . $serial . "#$$";
110 112
113
111# sending new ping email 114# sending new ping email
112my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout) 115%other_smtp_opts={};
116if ( $debug == 1 ) {
117 $other_smtp_opts{'Debug'} = 1;
118}
119
120my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout, %other_smtp_opts)
113 || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL'); 121 || nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
114($smtp->mail($sender) && 122($smtp->mail($sender) &&
115 $smtp->to($receiver) && 123 $smtp->to($receiver) &&
@@ -233,7 +241,8 @@ sub usage {
233 print " -pendwarn=num WARNING-state if more than num pending emails\n"; 241 print " -pendwarn=num WARNING-state if more than num pending emails\n";
234 print " -pendcrit=num CRITICAL \n"; 242 print " -pendcrit=num CRITICAL \n";
235 print " -maxmsg=num WARNING if more than num emails on POP3 (default 50)\n"; 243 print " -maxmsg=num WARNING if more than num emails on POP3 (default 50)\n";
236 print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n\n"; 244 print " -keeporphaned Set this to NOT delete orphaned E-Mail Ping msg from POP3\n";
245 print " -debug send SMTP tranaction info to stderr\n\n";
237 print " Options may abbreviated!\n"; 246 print " Options may abbreviated!\n";
238 print " LOST mails are mails, being sent before the last mail arrived back.\n"; 247 print " LOST mails are mails, being sent before the last mail arrived back.\n";
239 print " PENDING mails are those, which are not. (supposed to be on the way)\n"; 248 print " PENDING mails are those, which are not. (supposed to be on the way)\n";