1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
*** /tools/nagios/libexec/check_email_loop.pl.orig Fri Jan 28 08:08:29 2005
--- /tools/nagios/libexec/check_email_loop.pl Fri Jan 28 08:38:01 2005
***************
*** 42,51 ****
my $state = "UNKNOWN";
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost);
my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5);
! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit);
# Internal Vars
my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
my ($matchcount,$statfile) = (0,"check_email_loop.stat");
# Subs declaration
--- 42,52 ----
my $state = "UNKNOWN";
my ($sender,$receiver, $pophost, $popuser, $poppasswd, $smtphost);
my ($poptimeout,$smtptimeout,$pinginterval)=(60,60,5);
! my ($lostwarn, $lostcrit,$pendwarn, $pendcrit, $debug);
# Internal Vars
my ($pop,$msgcount,@msglines,$statinfo,@messageids,$newestid);
+ my(%other_smtp_opts);
my ($matchcount,$statfile) = (0,"check_email_loop.stat");
# Subs declaration
***************
*** 65,70 ****
--- 66,72 ----
my $status = GetOptions(
"from=s",\$sender,
"to=s",\$receiver,
+ "debug", \$debug,
"pophost=s",\$pophost,
"popuser=s",\$popuser,
"passwd=s",\$poppasswd,
***************
*** 101,108 ****
my $serial = time();
$serial = "ID#" . $serial . "#$$";
# sending new ping email
! my $smtp = Net::SMTP->new($smtphost,Timeout=>$smtptimeout)
|| nsexit("SMTP connect timeout ($smtptimeout s)",'CRITICAL');
($smtp->mail($sender) &&
$smtp->to($receiver) &&
--- 103,116 ----
my $serial = time();
$serial = "ID#" . $serial . "#$$";
+
# sending new ping email
! %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) &&
***************
*** 216,221 ****
--- 224,230 ----
print " -lostcrit=num CRITICAL \n";
print " -pendwarn=num WARNING-state if more than num pending emails\n";
print " -pendcrit=num CRITICAL \n";
+ print " -debug send SMTP tranaction info to stderr\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";
|