diff options
author | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2005-02-02 09:47:45 (GMT) |
---|---|---|
committer | Stanley Hopcroft <stanleyhopcroft@users.sourceforge.net> | 2005-02-02 09:47:45 (GMT) |
commit | 227c04a6886b708ce23cb9fd97e49b000228b1cb (patch) | |
tree | 4b88f2221a7c78d6052653c9407e88afd5a9d08a /contrib | |
parent | 93c1c1d84517f1d11a91636c4e045c9f2e8e279a (diff) | |
download | monitoring-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
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/check_email_loop.pl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/contrib/check_email_loop.pl b/contrib/check_email_loop.pl index 965f851..7e0a9f0 100644 --- a/contrib/check_email_loop.pl +++ b/contrib/check_email_loop.pl | |||
@@ -47,10 +47,11 @@ my %ERRORS = ('UNKNOWN' , '-1', | |||
47 | my $state = "UNKNOWN"; | 47 | my $state = "UNKNOWN"; |
48 | my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned); | 48 | my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost,$keeporphaned); |
49 | my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50); | 49 | my ($poptimeout,$smtptimeout,$pinginterval,$maxmsg)=(60,60,5,50); |
50 | my ($lostwarn, $lostcrit,$pendwarn, $pendcrit); | 50 | my ($lostwarn, $lostcrit,$pendwarn, $pendcrit,$debug); |
51 | 51 | ||
52 | # Internal Vars | 52 | # Internal Vars |
53 | my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); | 53 | my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid); |
54 | my (%other_smtp_opts); | ||
54 | my ($matchcount,$statfile) = (0,"check_email_loop.stat"); | 55 | my ($matchcount,$statfile) = (0,"check_email_loop.stat"); |
55 | 56 | ||
56 | # Subs declaration | 57 | # Subs declaration |
@@ -70,6 +71,7 @@ alarm($TIMEOUT); | |||
70 | my $status = GetOptions( | 71 | my $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") { | |||
108 | my $serial = time(); | 110 | my $serial = time(); |
109 | $serial = "ID#" . $serial . "#$$"; | 111 | $serial = "ID#" . $serial . "#$$"; |
110 | 112 | ||
113 | |||
111 | # sending new ping email | 114 | # sending new ping email |
112 | my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout) | 115 | %other_smtp_opts={}; |
116 | if ( $debug == 1 ) { | ||
117 | $other_smtp_opts{'Debug'} = 1; | ||
118 | } | ||
119 | |||
120 | my $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"; |